コード例 #1
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            StyleEditorEx.DrawContextField(this._contextProp);

            DrawPropertiesExcluding(serializedObject, ExcludedProperties);

            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.PropertyField(this._childrenProp);
            EditorGUI.EndDisabledGroup();

            GUILayout.Space(5);

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Fill Children", GUILayout.Width(220), GUILayout.Height(26)))
            {
                FillChildren(serializedObject);
            }

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.Space(10);

            _list.DoLayoutList();

            FillData(serializedObject);

            serializedObject.ApplyModifiedProperties();
        }
コード例 #2
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            StyleEditorEx.DrawContextField(_contextProp);

            DrawPropertiesExcluding(serializedObject, ExcludedProperties);

            EditorGUILayout.ObjectField(_targetProp);

            if (_targetProp.objectReferenceValue == null)
            {
                EditorGUILayout.HelpBox("Target is null", MessageType.Error);
            }

            GUILayout.Space(10);

            if (_assetProp != null)
            {
                EditorGUILayout.ObjectField(_assetProp);
            }

            if (_assetProp?.objectReferenceValue != null)
            {
                if (_styleAssetSerializedObject?.targetObject != _assetProp.objectReferenceValue)
                {
                    _styleAssetSerializedObject?.Dispose();

                    _styleAssetSerializedObject = new SerializedObject(_assetProp.objectReferenceValue);
                    _assetStyleListEditor       = new StyleListEditor(_styleAssetSerializedObject, Apply, false);
                }

                _assetStyleListEditor.DoLayout();
            }
            else
            {
                _styleAssetSerializedObject?.Dispose();
                _styleAssetSerializedObject = null;

                _selfStyleListEditor.DoLayout();
            }

            serializedObject.ApplyModifiedProperties();
        }