コード例 #1
0
        void DrawProperty(SerializedProperty property, int rootIdention, bool showChildren)
        {
            if (property.propertyType == SerializedPropertyType.ArraySize)
            {
                return;
            }
            property = property.Copy();
            EditorGUI.indentLevel = rootIdention + property.depth + 1;

            GUILayout.BeginHorizontal();

            PEPropertyHelper.PropertyFieldLayout(property, null, showChildren);

            if (targetProperty != null && targetProperty.serializedObject.targetObject == property.serializedObject.targetObject && property.propertyPath == targetProperty.propertyPath)
            {
                var rect = GUILayoutUtility.GetLastRect();
                EditorGUI.DrawRect(rect, new Color(0, 1, 0, 0.1f));
            }

            if (GUILayout.Button(GUIContent.none, this.plusButtonStyle, GUILayout.Width(30), GUILayout.Height(EditorGUIUtility.singleLineHeight)))
            {
                OnPick(property, !Event.current.control && !Event.current.command);
            }

            GUILayout.EndHorizontal();

            EditorGUI.indentLevel = rootIdention;
        }
コード例 #2
0
        void DrawNormal(Rect rect)
        {
            if (!IsGroup)
            {
                if (Property == null)
                {
                    var exposedProperty = (ExposedProperty)this.ExposedData.First();

                    if (exposedProperty.Target == null)
                    {
                        EditorGUI.LabelField(rect, Label.text, string.Format("Target missing! Path:{0}", exposedProperty.PropertyPath));
                    }
                    else
                    {
                        EditorGUI.LabelField(rect, Label.text, string.Format("Property missing! Path:{0}", exposedProperty.PropertyPath));
                    }
                    return;
                }

                Property.serializedObject.UpdateIfDirtyOrScript();

                EditorGUI.BeginChangeCheck();
                PEPropertyHelper.PropertyField(rect, Property, Label, true);

                if (EditorGUI.EndChangeCheck())
                {
                    Property.serializedObject.ApplyModifiedProperties();
                }

                Expanded = Property.isExpanded;
            }
            else
            {
                this.Expanded = EditorGUI.Foldout(rect, Expanded, Label);
            }
        }