Hello!, I have the following piece of code:
scrollPosition = GUI.BeginScrollView(new Rect(10, Screen.height - 400, 200, 300), scrollPosition, new Rect(0, 0, 200, 300));
GUILayout.TextArea(chat, GUILayout.ExpandHeight(true));
GUILayout.EndScrollView();
Whenever I run the project, I get the following errors over and over again:
InvalidOperationException: Operation is not valid due to the current state of the object
System.Collections.Stack.Pop () (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections/Stack.cs:329)
UnityEngine.GUILayoutUtility.EndLayoutGroup () (at C:/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayoutUtility.cs:279)
UnityEngine.GUILayout.EndScrollView (Boolean handleScrollWheel) (at C:/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayout.cs:427)
UnityEngine.GUILayout.EndScrollView () (at C:/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayout.cs:421)
main.OnGUI () (at Assets/Scripts/main.cs:1111)
InvalidOperationException: Operation is not valid due to the current state of the object
System.Collections.Stack.Peek () (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections/Stack.cs:321)
UnityEngine.GUILayoutUtility.EndLayoutGroup () (at C:/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayoutUtility.cs:280)
UnityEngine.GUILayout.EndScrollView (Boolean handleScrollWheel) (at C:/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayout.cs:427)
UnityEngine.GUILayout.EndScrollView () (at C:/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayout.cs:421)
main.OnGUI () (at Assets/Scripts/main.cs:1111)
I have a scroll view in another class and that is working just fine. So my question is, where do these errors come from and how can I fix them?