slavniyteo / one-line

One line property drawer for Unity3d
MIT License
146 stars 12 forks source link

OneLine can't initialize Inspector Window Utility and Naughty Attributes Errors #45

Closed AlexanderEvans closed 4 years ago

AlexanderEvans commented 4 years ago

General Info OS: Windows 10 pro version 1903 build 18362.418 Unity Version: 2019.2.4f1 OneLine Version: 0.5.0 according to package manager. Pretty sure I just pointed the manifest at the master git branch OneLine Installation: Git pointing at master RectEx Version: # only if changed manually ...no?


Describe the bug Not sure what this error means, but Oneline isn't showing the full text of the headers, and the message said to report the error, so, here goes.

Code Example

[SerializeField, ReorderableList]
List<MyKVP> RulesTemplate = new List<MyKVP>();

[System.Serializable]
public struct MyKVP
{
    [SerializeField, OneLine.OneLineWithHeader]
    public Key key;
    [SerializeField, OneLine.OneLineWithHeader]
    public Value value; 
}   [System.Serializable]
public struct Key
{
    public enum Use { GameState, Menu, GameState_And_Menu }
    public Use use;
    [ShowIf("SetIsGameState")]
    public CustomGCOTypes.GameState gameState;
    [ShowIf("SetIsMenu")]
    public bool Menu;
    public bool SetIsGameState() => use == Use.GameState || use == Use.GameState_And_Menu;
    public bool SetIsMenu() => use == Use.Menu || use == Use.GameState_And_Menu;
    //public bool SetIsGameStateAndMenu() => use == Use.GameState_And_Menu;
}

[System.Serializable]
public struct Value
{
    public enum Set { Movement, EnableInput, Movement_And_EnableInput}
    public Set toSet;
    [HideIf("SetIsEnableInput")]
    public CustomGCOTypes.MovementState movementState;
    [HideIf("SetIsMovement")]
    public bool EnableInputs;
    bool SetIsMovement() => toSet == Set.Movement;
    bool SetIsEnableInput() => toSet == Set.EnableInput;
    bool SetIsMovementAndEnableInput() => toSet == Set.Movement_And_EnableInput;
}

Screenshots If applicable, add screenshots to help explain your problem. image

Additional context Also, as a minor detail, Oneline doesn't seem to care about the drawing conditions from the NaughtyAttributes pakage defining wether or not to show fields. Not sure if this is an issue with one line or with naughty attributes, but figured I would mention it. I tried removing the ShowIf() HideIf() and Reordorable attributes though and got a similar error, so I don't think it is causing the message.

Full Error Msg

OneLine can not initialize Inspector Window Utility. 
You may experience some performance issues. 
Please create an issue on https://github.com/slavniyteo/one-line/ and we will repair it.

System.NullReferenceException: Object reference not set to an instance of an object
  at OneLine.InspectorUtil.Initialize () [0x00011] in F:\WorkingDevelopment\Repositories\Rogue-Trial\Rogue-Trial\Rogue Trial\Library\PackageCache\st.one-line@c7e88cdd50f3662dc2632b3951afbd8c987e1f11\Editor\Scripts\Utils\InspectorUtil.cs:51 
  at OneLine.InspectorUtil..ctor () [0x00045] in F:\WorkingDevelopment\Repositories\Rogue-Trial\Rogue-Trial\Rogue Trial\Library\PackageCache\st.one-line@c7e88cdd50f3662dc2632b3951afbd8c987e1f11\Editor\Scripts\Utils\InspectorUtil.cs:41 
UnityEngine.Debug:LogError(Object)
OneLine.InspectorUtil:.ctor() (at Library/PackageCache/st.one-line@c7e88cdd50f3662dc2632b3951afbd8c987e1f11/Editor/Scripts/Utils/InspectorUtil.cs:45)
OneLine.OneLinePropertyDrawer:.ctor() (at Library/PackageCache/st.one-line@c7e88cdd50f3662dc2632b3951afbd8c987e1f11/Editor/Scripts/OneLinePropertyDrawer.cs:36)
UnityEditor.EditorGUI:GetPropertyHeight(SerializedProperty)
NaughtyAttributes.Editor.<>c__DisplayClass2_0:<DrawProperty>b__2(Int32) (at Library/PackageCache/com.dbrizov.naughtyattributes@abf48092d8e608fb7340d6a447686ce0b4800709/Scripts/Editor/PropertyDrawers/ReorderableListPropertyDrawer.cs:47)
UnityEditorInternal.ReorderableList:GetElementYOffset(Int32, Int32) (at C:/buildslave/unity/build/Editor/Mono/GUI/ReorderableList.cs:342)
UnityEditorInternal.ReorderableList:GetElementYOffset(Int32) (at C:/buildslave/unity/build/Editor/Mono/GUI/ReorderableList.cs:330)
UnityEditorInternal.ReorderableList:GetListElementHeight() (at C:/buildslave/unity/build/Editor/Mono/GUI/ReorderableList.cs:439)
UnityEditorInternal.ReorderableList:DoLayoutList() (at C:/buildslave/unity/build/Editor/Mono/GUI/ReorderableList.cs:390)
NaughtyAttributes.Editor.ReorderableListPropertyDrawer:DrawProperty(SerializedProperty) (at Library/PackageCache/com.dbrizov.naughtyattributes@abf48092d8e608fb7340d6a447686ce0b4800709/Scripts/Editor/PropertyDrawers/ReorderableListPropertyDrawer.cs:54)
NaughtyAttributes.Editor.InspectorEditor:DrawField(FieldInfo) (at Library/PackageCache/com.dbrizov.naughtyattributes@abf48092d8e608fb7340d6a447686ce0b4800709/Scripts/Editor/Editors/InspectorEditor.cs:242)
NaughtyAttributes.Editor.InspectorEditor:ValidateAndDrawField(FieldInfo) (at Library/PackageCache/com.dbrizov.naughtyattributes@abf48092d8e608fb7340d6a447686ce0b4800709/Scripts/Editor/Editors/InspectorEditor.cs:196)
NaughtyAttributes.Editor.InspectorEditor:OnInspectorGUI() (at Library/PackageCache/com.dbrizov.naughtyattributes@abf48092d8e608fb7340d6a447686ce0b4800709/Scripts/Editor/Editors/InspectorEditor.cs:138)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
AlexanderEvans commented 4 years ago

Ah, I found a way to expand the fields with the Width() attribute. Still getting the error though.

slavniyteo commented 4 years ago

Hi, thank you for reporting.

You observe two different problems:


To get know OneLine better, see full reference with examples and screenshots here.


I close this issue but feel free to reopen it.

Yet one more time, thank you for reporting.