[Bug : Unity 2019.1] Inspector Visibility.cs Throws Error: "'m_ScrollPosition' is not defined"

Tanman555

New member
When I opened my project in Unity 2019.1, there's an error that is thrown repeatedly whenever I inspect my character. The inspectors for most scripts aren't being loaded properly, due to an error that keeps popping up in the console.

Code:
ArgumentException: Instance field 'm_ScrollPosition' is not defined for type 'UnityEditor.InspectorWindow'
System.Linq.Expressions.Expression.Field (System.Linq.Expressions.Expression expression, System.String fieldName) (at <3e4da02cf86b4fc686ed0ac61bffc210>:0)
Opsive.UltimateCharacterController.Editor.Inspectors.Utility.InspectorVisibility.IsVisible (UnityEditor.Editor editor) (at Assets/Opsive/UltimateCharacterController/Editor/Inspectors/Utility/InspectorVisibility.cs:94)
Opsive.UltimateCharacterController.Editor.Inspectors.StateSystem.StateBehaviorInspector.OnInspectorGUI () (at Assets/Opsive/UltimateCharacterController/Editor/Inspectors/StateSystem/StateBehaviorInspector.cs:88)
UnityEditor.UIElements.InspectorElement+<CreateIMGUIInspectorFromEditor>c__AnonStorey1.<>m__0 () (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorElement.cs:445)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
The error is coming from the InspectorVisibility script, in the IsVisible method.

C#:
Func<Vector2> scrollPositionFunction;
if (!s_EditorWindowScrollPositionFunction.TryGetValue(editorWindow, out scrollPositionFunction)) {
// Create the delegate because it's faster to access then reflected fields.
var fieldExpression = Expression.Field(Expression.Constant(editorWindow), c_ScrollPositionString);
if (fieldExpression != null) {
scrollPositionFunction = Expression.Lambda<Func<Vector2>>(fieldExpression).Compile();
}
s_EditorWindowScrollPositionFunction.Add(editorWindow, scrollPositionFunction);
}
The c_ScrollPositionString string variable, with the value m_ScrollPosition, is an internal inspector window variable that the script is trying to retrieve. The error is being thrown because the m_ScrollPosition variable has been omitted from the InspectorWindow class in Unity 2019.1. I can clearly see this when I decompile the Unity Editor assembly for Unity 2018.3 and 2019.1 side by side.
 

Tanman555

New member
I tried simply commenting out all the code, starting from the `Func<Vector2> scrollPositionFunction;` variable, in the IsVisible method. At the bottom, I simply return true. I noticed that after I compiled and inspected my character, there is no more errors. Everything seems to work as expected. I don't know exactly what this code is trying to do, I'm assuming there's very little functionality hooked up to this delegate dictionary right now.

I've tried several Opsive GUI windows and tools, even a little bit of Behavior Designer, and everything seems to work fine with Unity 2019.1.0f1.
 
Last edited:

transat

New member
I had this as well but no longer. I think the issue might be related to having 2 inspectors open at once.
 

Justin

Administrator
Staff member
This has been fixed with version 2.1.3 and has been released on the Asset Store
 
Top