Page 1 of 1

issue with AdventureCreatorBridge EnforceCursor .MoveNext

Posted: Wed Jul 05, 2023 2:21 pm
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?

Re: issue with AdventureCreatorBridge EnforceCursor .MoveNext

Posted: Wed Jul 05, 2023 3:10 pm
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.

Re: issue with AdventureCreatorBridge EnforceCursor .MoveNext

Posted: Sun Jul 16, 2023 8:39 pm
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.