issue with AdventureCreatorBridge EnforceCursor .MoveNext

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
gblekkenhorst
Posts: 83
Joined: Wed Jun 24, 2020 5:06 pm

issue with AdventureCreatorBridge EnforceCursor .MoveNext

Post by gblekkenhorst »

Occasionally when loading a scene from the adventure creator save system, this error is being thrown. (Let me know if this is a question for the AC forums.)

Code: Select all

NullReferenceException: Object reference not set to an instance of an object
PixelCrushers.DialogueSystem.AdventureCreatorSupport.AdventureCreatorBridge+<EnforceCursor>d__55.MoveNext () (at Assets/Pixel Crushers/Dialogue System/Third Party Support/Adventure Creator Support/Scripts/AdventureCreatorBridge.cs:401)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <d3b66f0ad4e34a55b6ef91ab84878193>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
The line it's pinging is

Code: Select all

KickStarter.playerInput.SetInGameCursorState(false);
It's likely to do with this script I have that makes sure the cursor is enabled when you open the menu, and then checks if it needs to be turned on or off when it loads the save.

Code: Select all

     if (!value) // if pausing 
            {
                if (AC.KickStarter.cursorManager.cursorDisplay == CursorDisplay.Never)
                    GlobalVariables.SetBooleanValue(40, false);
                else
                    GlobalVariables.SetBooleanValue(40, true);

                EnableCursor();

            } else   // if unpausing
            {
                if (GlobalVariables.GetBooleanValue(40) == true)  // If cursor was enabled when we paused, keep it enabled
                    EnableCursor();
                else                                             // Otherwise, disable it again
                    DisableCursor();


            }

Code: Select all

             void EnableCursor()
        {
            AC.KickStarter.cursorManager.cursorDisplay = CursorDisplay.Always;
            AC.PlayerMenus.GetElementWithName("Hotspot", "HotspotLabel").IsVisible = true;
            AC.KickStarter.stateHandler.SetCursorSystem(true);
        }      
Is the adventure bridge being interfered with by my accessing the SetCursorSystem?
User avatar
Tony Li
Posts: 22119
Joined: Thu Jul 18, 2013 1:27 pm

Re: issue with AdventureCreatorBridge EnforceCursor .MoveNext

Post by Tony Li »

Hi,

Does it break any functionality? Otherwise it's possible that KickStarter.playerInput is temporarily null under some normal functioning of AC. If that's the case, I'll update the AdventureCreatorBridge component to check if KickStarter.playerInput is currently null.
gblekkenhorst
Posts: 83
Joined: Wed Jun 24, 2020 5:06 pm

Re: issue with AdventureCreatorBridge EnforceCursor .MoveNext

Post by gblekkenhorst »

Yeah, it's come up again and it does freeze the game. I've put a null check in there for know, I'll let you know if it surfaces again.
Post Reply