Esempio n. 1
0
    //Using Odin Enum Drawer (Toggle) instead of Unity Dropdown
    //http://www.sirenix.net/odininspector/faq/48/can-i-write-my-own-custom-editor-code-using-odin
    //https://odininspector.com/tutorials/how-to-create-custom-drawers-using-odin/how-to-use-the-propertytree
    protected override void PropertyField()
    {
        myObjectTree.BeginDraw(true);
        var someProp1 = myObjectTree.GetPropertyAtPath("defaultStateType");

        someProp1.Draw();
        myObjectTree.EndDraw();
    }
        public override void OnInspectorGUI()
        {
            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Script"));
            EditorGUI.EndDisabledGroup();
#if ODIN_INSPECTOR
            if (propertyTree != null)
            {
#if ODIN_INSPECTOR_3
                propertyTree.BeginDraw(true);
                propertyTree.Draw();
                propertyTree.EndDraw();
#else
                Sirenix.OdinInspector.Editor.InspectorUtilities.BeginDrawPropertyTree(propertyTree, true);
                propertyTree.Draw();
                Sirenix.OdinInspector.Editor.InspectorUtilities.EndDrawPropertyTree(propertyTree);
#endif
            }
#else
            EditorGUI.BeginChangeCheck();
            SerializedProperty iterator = serializedObject.GetIterator();
            iterator.NextVisible(true);
            do
            {
                if (iterator.name == "m_Script")
                {
                    continue;
                }
                EditorGUILayout.PropertyField(iterator);
            } while (iterator.NextVisible(false));

            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
            }
            serializedObject.Update();
#endif
        }