Example #1
0
        public static Type Draw <Type>(Func <Type> method, bool indention = true)
        {
            int indentValue = EditorGUI.indentLevel;

            indention = EditorUI.allowIndention && indention;
            if (EditorUI.space != 0)
            {
                GUILayout.Space(EditorUI.space);
            }
            if (!indention)
            {
                EditorGUI.indentLevel = 0;
            }
            bool wasChanged = GUI.changed;

            GUI.changed = false;
            Type value = (Type)method();

            EditorUI.lastChanged  = GUI.changed;
            EditorUI.anyChanged   = GUI.changed = GUI.changed || wasChanged;
            EditorGUI.indentLevel = indentValue;
            if (EditorUI.resetField)
            {
                EditorUI.SetFieldSize(EditorUI.resetFieldSize, false);
            }
            if (EditorUI.resetLayout)
            {
                EditorUI.ResetLayout();
            }
            return(value);
        }