inkle / ink-unity-integration

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

Ink Player GUI Errors #187

Closed starmaid closed 1 year ago

starmaid commented 1 year ago

Unity Version 2022.3.4f1 or 2021.3.28f1 Ink Unity Integration Version 1.1.7 or 1.1.5 from GitHub Releases OR 1.0.0 from Unity Hub

I've tried brand new installs of everything I can think of, and everything is at the latest version. Apologies if I'm missing something simple - I'm brand new to Unity.

Steps to reproduce:

First, not sure if this is related, but loading the scene throws two warnings and one error:

ERROR: Broken text PPtr in file(Assets/Ink/Demos/Basic Demo/Basic Demo.unity). Local file identifier (1908123725) doesn't exist!

WARNING: Problem detected while opening the Scene file: 'Assets/Ink/Demos/Basic Demo/Basic Demo.unity'.
Check the following logs for more details.
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

WARNING: Component at index 2 could not be loaded when loading game object 'Canvas'. Removing it.
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Then I try to click the file Assets/Ink/Demos/Basic Demo/Ink/story.ink and hit Play in the inspector window for the .ink file. Upon hitting Play, the Inspector switches to the Ink Player window. The Ink Player doesn't seem to be doing anything (the UI buttons are all there, but no text is appearing in the main body area) then, you notice about 1000 errors per second are thrown, just these four in a loop:

GUI Error: Invalid GUILayout state in InkPlayerWindow view. Verify that all layout Begin/End calls match
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

NullReferenceException: Object reference not set to an instance of an object
UnityEngine.GUILayoutUtility.DoGetRect (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <82a3a4e0a0a94de5afddd345f6cf50d1>:0)
UnityEngine.GUILayoutUtility.GetRect (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <82a3a4e0a0a94de5afddd345f6cf50d1>:0)
UnityEngine.GUILayout.DoTextField (System.String text, System.Int32 maxLength, System.Boolean multiline, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <82a3a4e0a0a94de5afddd345f6cf50d1>:0)
UnityEngine.GUILayout.TextField (System.String text, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <82a3a4e0a0a94de5afddd345f6cf50d1>:0)
Ink.UnityIntegration.InkPlayerWindow.DrawSearchBar (System.String& searchString) (at Assets/Ink/Editor/Tools/Player Window/InkPlayerWindow.cs:2636)
Ink.UnityIntegration.InkPlayerWindow.DisplayStoryHeader () (at Assets/Ink/Editor/Tools/Player Window/InkPlayerWindow.cs:1363)
Ink.UnityIntegration.InkPlayerWindow.DrawStoryHistory () (at Assets/Ink/Editor/Tools/Player Window/InkPlayerWindow.cs:1295)
Ink.UnityIntegration.InkPlayerWindow.OnGUI () (at Assets/Ink/Editor/Tools/Player Window/InkPlayerWindow.cs:1129)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition) (at <da771086bc2e4cfc9ad0a72e083a7f98>:0)
UnityEditor.DockArea.DrawView (UnityEngine.Rect dockAreaRect) (at <da771086bc2e4cfc9ad0a72e083a7f98>:0)
UnityEditor.DockArea.OldOnGUI () (at <da771086bc2e4cfc9ad0a72e083a7f98>: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 <e66f217a64a747d48b478f0d70978704>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

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

ArgumentException: Getting control 8's position in a group with only 8 controls when doing repaint
Aborting
UnityEngine.GUILayoutGroup.GetNext () (at <82a3a4e0a0a94de5afddd345f6cf50d1>:0)
UnityEngine.GUILayoutUtility.DoGetRect (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <82a3a4e0a0a94de5afddd345f6cf50d1>:0)
UnityEngine.GUILayoutUtility.GetRect (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <82a3a4e0a0a94de5afddd345f6cf50d1>:0)
UnityEngine.GUILayout.DoTextField (System.String text, System.Int32 maxLength, System.Boolean multiline, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <82a3a4e0a0a94de5afddd345f6cf50d1>:0)
UnityEngine.GUILayout.TextField (System.String text, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <82a3a4e0a0a94de5afddd345f6cf50d1>:0)
Ink.UnityIntegration.InkPlayerWindow.DrawSearchBar (System.String& searchString) (at Assets/Ink/Editor/Tools/Player Window/InkPlayerWindow.cs:2636)
Ink.UnityIntegration.InkPlayerWindow.DisplayStoryHeader () (at Assets/Ink/Editor/Tools/Player Window/InkPlayerWindow.cs:1363)
Ink.UnityIntegration.InkPlayerWindow.DrawStoryHistory () (at Assets/Ink/Editor/Tools/Player Window/InkPlayerWindow.cs:1295)
Ink.UnityIntegration.InkPlayerWindow.OnGUI () (at Assets/Ink/Editor/Tools/Player Window/InkPlayerWindow.cs:1129)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition) (at <da771086bc2e4cfc9ad0a72e083a7f98>:0)
UnityEditor.DockArea.DrawView (UnityEngine.Rect dockAreaRect) (at <da771086bc2e4cfc9ad0a72e083a7f98>:0)
UnityEditor.DockArea.OldOnGUI () (at <da771086bc2e4cfc9ad0a72e083a7f98>: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 <e66f217a64a747d48b478f0d70978704>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <e66f217a64a747d48b478f0d70978704>:0)
UnityEngine.UIElements.IMGUIContainer.DoIMGUIRepaint () (at <e66f217a64a747d48b478f0d70978704>:0)
UnityEngine.UIElements.UIR.RenderChainCommand.ExecuteNonDrawMesh (UnityEngine.UIElements.UIR.DrawParams drawParams, System.Single pixelsPerPoint, System.Exception& immediateException) (at <e66f217a64a747d48b478f0d70978704>:0)
Rethrow as ImmediateModeException
UnityEngine.UIElements.UIR.RenderChain.Render () (at <e66f217a64a747d48b478f0d70978704>:0)
UnityEngine.UIElements.UIRRepaintUpdater.Update () (at <e66f217a64a747d48b478f0d70978704>:0)
UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase phase) (at <e66f217a64a747d48b478f0d70978704>:0)
UnityEngine.UIElements.Panel.UpdateForRepaint () (at <e66f217a64a747d48b478f0d70978704>:0)
UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event e) (at <e66f217a64a747d48b478f0d70978704>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <e66f217a64a747d48b478f0d70978704>:0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <e66f217a64a747d48b478f0d70978704>:0)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <e66f217a64a747d48b478f0d70978704>:0)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <e66f217a64a747d48b478f0d70978704>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <82a3a4e0a0a94de5afddd345f6cf50d1>:0)

Playing the game works, and I can use the ink-driven dialogue just fine, but the GUI Ink Player window is constantly throwing these errors, the whole time.

Any ideas?

tomkail commented 1 year ago

Hi! Sorry about that - it’s fixed on the latest commit but I’ve not gotten around to making a new UnityPackage for it yet. I’ll do that in the next few days! Sorry to make it tricky for you to get started! You should be able to just ignore those errors for now, or else look at the fix in the last commit.

On Sat, 8 Jul 2023 at 09:31, Nicky Masso @.***> wrote:

Unity Version 2022.3.4f1 or 2021.3.28f1 Ink Unity Integration Version 1.1.7 or 1.1.5 from GitHub Releases OR 1.0.0 from Unity Hub

I've tried brand new installs of everything I can think of, and everything is at the latest version. Apologies if I'm missing something simple - I'm brand new to Unity.

Steps to reproduce:

  • Fresh install of Unity
  • Create new project, 2D or 3D, wait for it to load
  • Go to downloads, double-click Ink.Unity.Integration.1.1.7.unitypackage
  • Unity dialogue box for importing a package comes up, click Import All
  • Double click to load scene Assets/Ink/Demos/Basic Demo/Basic Demo.unity

First, not sure if this is related, but loading the scene throws two warnings and one error:

ERROR: Broken text PPtr in file(Assets/Ink/Demos/Basic Demo/Basic Demo.unity). Local file identifier (1908123725) doesn't exist!

WARNING: Problem detected while opening the Scene file: 'Assets/Ink/Demos/Basic Demo/Basic Demo.unity'. Check the following logs for more details. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

WARNING: Component at index 2 could not be loaded when loading game object 'Canvas'. Removing it. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Then I try to click the file Assets/Ink/Demos/Basic Demo/Ink/story.ink and hit Play in the inspector window for the .ink file. Upon hitting Play, the Inspector switches to the Ink Player window. Then, about 1000 errors per second are thrown, just these four in a loop:

GUI Error: Invalid GUILayout state in InkPlayerWindow view. Verify that all layout Begin/End calls match UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

NullReferenceException: Object reference not set to an instance of an object UnityEngine.GUILayoutUtility.DoGetRect (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <82a3a4e0a0a94de5afddd345f6cf50d1>:0) UnityEngine.GUILayoutUtility.GetRect (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <82a3a4e0a0a94de5afddd345f6cf50d1>:0) UnityEngine.GUILayout.DoTextField (System.String text, System.Int32 maxLength, System.Boolean multiline, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <82a3a4e0a0a94de5afddd345f6cf50d1>:0) UnityEngine.GUILayout.TextField (System.String text, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <82a3a4e0a0a94de5afddd345f6cf50d1>:0) Ink.UnityIntegration.InkPlayerWindow.DrawSearchBar (System.String& searchString) (at Assets/Ink/Editor/Tools/Player Window/InkPlayerWindow.cs:2636) Ink.UnityIntegration.InkPlayerWindow.DisplayStoryHeader () (at Assets/Ink/Editor/Tools/Player Window/InkPlayerWindow.cs:1363) Ink.UnityIntegration.InkPlayerWindow.DrawStoryHistory () (at Assets/Ink/Editor/Tools/Player Window/InkPlayerWindow.cs:1295) Ink.UnityIntegration.InkPlayerWindow.OnGUI () (at Assets/Ink/Editor/Tools/Player Window/InkPlayerWindow.cs:1129) UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition) (at :0) UnityEditor.DockArea.DrawView (UnityEngine.Rect dockAreaRect) (at :0) UnityEditor.DockArea.OldOnGUI () (at :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.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

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

ArgumentException: Getting control 8's position in a group with only 8 controls when doing repaint Aborting UnityEngine.GUILayoutGroup.GetNext () (at <82a3a4e0a0a94de5afddd345f6cf50d1>:0) UnityEngine.GUILayoutUtility.DoGetRect (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <82a3a4e0a0a94de5afddd345f6cf50d1>:0) UnityEngine.GUILayoutUtility.GetRect (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <82a3a4e0a0a94de5afddd345f6cf50d1>:0) UnityEngine.GUILayout.DoTextField (System.String text, System.Int32 maxLength, System.Boolean multiline, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <82a3a4e0a0a94de5afddd345f6cf50d1>:0) UnityEngine.GUILayout.TextField (System.String text, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <82a3a4e0a0a94de5afddd345f6cf50d1>:0) Ink.UnityIntegration.InkPlayerWindow.DrawSearchBar (System.String& searchString) (at Assets/Ink/Editor/Tools/Player Window/InkPlayerWindow.cs:2636) Ink.UnityIntegration.InkPlayerWindow.DisplayStoryHeader () (at Assets/Ink/Editor/Tools/Player Window/InkPlayerWindow.cs:1363) Ink.UnityIntegration.InkPlayerWindow.DrawStoryHistory () (at Assets/Ink/Editor/Tools/Player Window/InkPlayerWindow.cs:1295) Ink.UnityIntegration.InkPlayerWindow.OnGUI () (at Assets/Ink/Editor/Tools/Player Window/InkPlayerWindow.cs:1129) UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition) (at :0) UnityEditor.DockArea.DrawView (UnityEngine.Rect dockAreaRect) (at :0) UnityEditor.DockArea.OldOnGUI () (at :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.DoIMGUIRepaint () (at :0) UnityEngine.UIElements.UIR.RenderChainCommand.ExecuteNonDrawMesh (UnityEngine.UIElements.UIR.DrawParams drawParams, System.Single pixelsPerPoint, System.Exception& immediateException) (at :0) Rethrow as ImmediateModeException UnityEngine.UIElements.UIR.RenderChain.Render () (at :0) UnityEngine.UIElements.UIRRepaintUpdater.Update () (at :0) UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase phase) (at :0) UnityEngine.UIElements.Panel.UpdateForRepaint () (at :0) UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event e) (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 <82a3a4e0a0a94de5afddd345f6cf50d1>:0)

Playing the game works, and I can use the ink-driven dialogue just fine, but the GUI Ink Player window is constantly throwing these errors, the whole time.

Any ideas?

— Reply to this email directly, view it on GitHub https://github.com/inkle/ink-unity-integration/issues/187, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJR3UAJV475M3RB77EZJY3XPELE7ANCNFSM6AAAAAA2CWYHKM . You are receiving this because you are subscribed to this thread.Message ID: @.***>

starmaid commented 1 year ago

You're the best! I'll keep an eye out.

AwesomeGameConcepts commented 1 year ago

I have similar issue too with the Ink Unity Integration Version 1.1.7 And Unity 2022.3.f1 . When I try to open the InkPlayer the console pop an infinite number of the same error => there is something wrong with OnGUI. The draw of the windows is not full. After some investigation i have a null reference on the line 2637, the variable searchTextFieldStyle and at the next line searchCancelButtonStyle are null. So i change this function with a null check and a default instantiation static bool DrawSearchBar(ref string searchString) { var lastString = searchString; searchString = GUILayout.TextField(searchString, searchTextFieldStyle is null ? new GUIStyle() : searchTextFieldStyle); if (GUILayout.Button("", searchCancelButtonStyle is null ? new GUIStyle() : searchCancelButtonStyle)) { searchString = string.Empty; } return lastString != searchString; } After recompile it work like a charm :) . I Hope it will help you ;)

tomkail commented 1 year ago

Ah! Just a lil update on this - seems that Unity fixed the typo in "ToolbarSeachTextField" in the more recent versions, which explains why we'd not heard of this issue until recently! It's hard to pin down exactly which version broke it and they've backported the fix to some of the LTS versions, so the best thing here is to just check for the existence of both. I've pushed a fix - I'll be doing a new release tomorrow.