inkle / ink-unity-integration

Unity integration for the open source ink narrative scripting language.
http://www.inklestudios.com/ink
Other
578 stars 101 forks source link

VariablesState error "Object reference is not set to an instance of an object" with Unity Ink Player #170

Closed Bard09 closed 1 year ago

Bard09 commented 2 years ago

I have a story that runs correctly in Inky 0.13.0 and also plays successfully when I swap it into the Ink Unity demo application (1.0.0). However, when I load it into the Ink Player that runs alongside the Inspector in Unity, clicking on my first choice results in the following error:

NullReferenceException: Object reference not set to an instance of an object Ink.Runtime.VariablesState.get_Item (System.String variableName) (at Assets/Ink/InkLibs/InkRuntime/VariablesState.cs:77) Ink.UnityIntegration.InkPlayerWindow.DrawObservableVariable (System.String variable, System.String& variableToChange, System.Object& newVariableValue) (at Assets/Ink/Editor/Tools/Player Window/InkPlayerWindow.cs:1985) Ink.UnityIntegration.InkPlayerWindow.DrawVariablesPanel () (at Assets/Ink/Editor/Tools/Player Window/InkPlayerWindow.cs:1967) Ink.UnityIntegration.InkPlayerWindow.DrawVariables () (at Assets/Ink/Editor/Tools/Player Window/InkPlayerWindow.cs:1938) Ink.UnityIntegration.InkPlayerWindow.OnGUI () (at Assets/Ink/Editor/Tools/Player Window/InkPlayerWindow.cs:953) UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition) (at <4e64905d831f4883a53259ef37fb023b>:0) UnityEditor.DockArea.DrawView (UnityEngine.Rect dockAreaRect) (at <4e64905d831f4883a53259ef37fb023b>:0) UnityEditor.DockArea.OldOnGUI () (at <4e64905d831f4883a53259ef37fb023b>:0) UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at :0) UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at :0) UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at :0) UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at :0) UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at :0) UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at :0) UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at :0) UnityEngine.UIElements.EventDispatchUtilities.PropagateEvent (UnityEngine.UIElements.EventBase evt) (at :0) UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToRegularTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at :0) UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at :0) UnityEngine.UIElements.MouseEventDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel iPanel) (at :0) UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at :0) UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at :0) UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at :0) UnityEngine.UIElements.EventDispatcher.OpenGate () (at :0) UnityEngine.UIElements.EventDispatcherGate.Dispose () (at :0) UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at :0) UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at :0) UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at :0) UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at :0) UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at :0) UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at :0) UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at :0) UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <24cb545f0fda44d7a6fbdc3f90b29dfb>:0)

Unity also shows the following error, presumably because the Ink Player keeps running/failing:

GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

I'm very, very new to Unity but this does appear to be a bug. Let me know if there's anything I can do to help!

tomkail commented 2 years ago

Thanks! Can you share the story?

On Wed, 26 Oct 2022 at 07:46, Bard09 @.***> wrote:

I have a story that runs correctly in Inky 0.13.0 and also plays successfully when I swap it into the Ink Unity demo application (1.0.0). However, when I load it into the Ink Player that runs alongside the Inspector in Unity, clicking on my first choice results in the following error:

NullReferenceException: Object reference not set to an instance of an object Ink.Runtime.VariablesState.get_Item (System.String variableName) (at Assets/Ink/InkLibs/InkRuntime/VariablesState.cs:77) Ink.UnityIntegration.InkPlayerWindow.DrawObservableVariable (System.String variable, System.String& variableToChange, System.Object& newVariableValue) (at Assets/Ink/Editor/Tools/Player Window/InkPlayerWindow.cs:1985) Ink.UnityIntegration.InkPlayerWindow.DrawVariablesPanel () (at Assets/Ink/Editor/Tools/Player Window/InkPlayerWindow.cs:1967) Ink.UnityIntegration.InkPlayerWindow.DrawVariables () (at Assets/Ink/Editor/Tools/Player Window/InkPlayerWindow.cs:1938) Ink.UnityIntegration.InkPlayerWindow.OnGUI () (at Assets/Ink/Editor/Tools/Player Window/InkPlayerWindow.cs:953) UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition) (at

<4e64905d831f4883a53259ef37fb023b>:0) UnityEditor.DockArea.DrawView (UnityEngine.Rect dockAreaRect) (at <4e64905d831f4883a53259ef37fb023b>:0) UnityEditor.DockArea.OldOnGUI () (at <4e64905d831f4883a53259ef37fb023b>:0) UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at :0) UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at :0) UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at :0) UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at :0) UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at :0) UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at :0) UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at :0) UnityEngine.UIElements.EventDispatchUtilities.PropagateEvent (UnityEngine.UIElements.EventBase evt) (at :0) UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToRegularTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at :0) UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at :0) UnityEngine.UIElements.MouseEventDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel iPanel) (at :0) UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at :0) UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at :0) UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at :0) UnityEngine.UIElements.EventDispatcher.OpenGate () (at :0) UnityEngine.UIElements.EventDispatcherGate.Dispose () (at :0) UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at :0) UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at :0) UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at :0) UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at :0) UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at :0) UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at :0) UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at :0) UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <24cb545f0fda44d7a6fbdc3f90b29dfb>:0) Unity also shows the following error, presumably because the Ink Player keeps running/failing: GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) I'm very, very new to Unity but this does appear to be a bug. Let me know if there's anything I can do to help! — Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
Bard09 commented 2 years ago

@tomkail I'm not super-comfortable posting it publicly at this time. Not that it's a genius game idea or anything, it just makes me nervous. If there's a secure private way I can get it to you, let me know.

tomkail commented 2 years ago

Sure! So first thing to do is check you’re on the latest version, which is 1.1.3. You can find it on the releases page. If you are, see if you can reproduce it with another story, and then see if you can work out the simplest story that triggers it. You can email it to me at @.***

On Wed, 26 Oct 2022 at 19:41, Bard09 @.***> wrote:

@tomkail https://github.com/tomkail I'm not super-comfortable posting it publicly at this time. Not that it's a genius game idea or anything, it just makes me nervous. If there's a secure private way I can get it to you, let me know.

— Reply to this email directly, view it on GitHub https://github.com/inkle/ink-unity-integration/issues/170#issuecomment-1292449658, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJR3UAELULMPXKO3EGFHHDWFF3O5ANCNFSM6AAAAAAROVA5WM . You are receiving this because you were mentioned.Message ID: @.***>

Bard09 commented 1 year ago

@tomkail Thanks-- upgrading did the trick. The story isn't failing anymore!

I don't know if it's a bug or a feature, though, but even after installing the recent version (and resolving my bug) Unity is still displaying 1.0.0 in Package Manager.