Sudden "Assertion Failed" error in DialogueSystemController

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Itilos
Posts: 21
Joined: Thu Oct 20, 2022 12:03 am

Sudden "Assertion Failed" error in DialogueSystemController

Post by Itilos »

Hello!

I started working with the Dialogue System and everything has been going well, but suddenly I started getting the following error:

Code: Select all

Assertion failed on expression: 'm_GameObjects.find(gameObject.GetInstanceID()) == m_GameObjects.end()'
UnityEngine.StackTraceUtility:ExtractStackTrace ()
PixelCrushers.DialogueSystem.DialogueSystemController:Awake () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Manager/DialogueSystemController.cs:399)
This maps to this code within the DialogueSystemController:

Code: Select all

if (dontDestroyOnLoad)
{
   if (this.transform.parent != null) this.transform.SetParent(null, false);
   DontDestroyOnLoad(this.gameObject); <---- this line
}
I set up the Dialogue System in the scene a bit ago, and have been working on other things, but then randomly started getting the error.

Does anyone know where this might be coming from? I'm kind of at a loss as the error isn't super helpful.
User avatar
Tony Li
Posts: 21965
Joined: Thu Jul 18, 2013 1:27 pm

Re: Sudden "Assertion Failed" error in DialogueSystemController

Post by Tony Li »

Hi,

This is a (fortunately completely harmless) Unity bug that most frequently occurs when a GameObject's Scene visibility is toggled off and the GameObject is moved at runtime from its scene to the runtime-temporary DontDestroyOnLoad scene. For one frame, the Scene view essentially reports that it doesn't know where that GameObject is, but then it catches up and everything's fine.

It won't be present in builds because, of course, there's no Unity editor Scene view window in builds. Unity will probably get around to fixing it somewhere in the 2022.x line.
Post Reply