NullReferenceException when trying to replace the character for a new one

We’re updating the character (the game object with the ConvaiNPC class) by deleting the old one and adding the new one under NPC to Player Interaction.

But by doing this we’re getting this error when running the game:

How can we fix this? Maybe we need to update some references?

Hello @Bruno_Leonardo_Miche,

The error is unclear. Could you share more details?

The character game object was swapped like this

One thing we noticed was that the character reference was lost in here:

image

We’re wondering if there are more places/things we have to update, because after that clicking Build & Run, then opening the console causes the error to show up thousands of times.

This behavior is expected, if you delete or swap a character, any scripts referencing it will throw null errors. As a temporary step, you can enable Full With Stacktrace (see Unity docs: https://docs.unity3d.com/6000.1/Documentation/Manual/class-PlayerSettingsWebGL.html#wasm-language-features under Enable Exception) to get more detailed logs. Then, update those scripts with the reference to your new character.

After reviewing the DIFFs it seems the only reference is in the Convai Interactables Data.

But what was actually causing the issue was missing references in lipsync.

If anyone runs into an issue like this make sure you have all references set.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.