Esempio n. 1
0
 public static bool ToggleGroup(string label, bool toggle, DrawDelegate draw)
 {
     toggle = EditorGUILayout.BeginToggleGroup(label, toggle);
     EditorGUILayoutHelper.Indent(draw);
     EditorGUILayout.EndToggleGroup();
     return(toggle);
 }
Esempio n. 2
0
 public static bool Foldout(bool foldout, string content, DrawDelegate draw)
 {
     foldout = EditorGUILayout.Foldout(foldout, content);
     if (foldout)
     {
         EditorGUILayoutHelper.Indent(draw);
     }
     return(foldout);
 }
Esempio n. 3
0
        void DrawWithEditor(SerializedProperty property)
        {
            Editor editor = Editor.CreateEditor(property.objectReferenceValue);

            if (editor == null)
            {
                return;
            }

            Rect foldoutRect = GUILayoutUtility.GetLastRect();

            foldoutRect.width   = 20.0f;
            property.isExpanded = EditorGUI.Foldout(foldoutRect, property.isExpanded, "");

            if (property.isExpanded)
            {
                if (property.isArray)
                {
                    property.arraySize = EditorGUILayout.IntField("Size", property.arraySize);
                }

                try
                {
                    EditorGUILayoutHelper.Indent(() =>
                    {
                        editor.OnInspectorGUI();
                    });
                }
                catch (Exception exc)
                {
                    Dbg.LogExc(exc);
                    Dbg.LogErrorRelease("Exception thrown with InlineObjectAttriute.useEditor = true. Does the serialized object type have an Editor?");
                    throw exc;
                }
            }
        }