Exemple #1
0
        /// <summary>
        /// Draws the View.
        /// </summary>
        public void Draw()
        {
            EditorGUI.BeginChangeCheck();

            list.DoLayoutList();

            if (EditorGUI.EndChangeCheck())            //check if the editor changed since drawing the list
            {
                OnEditorValueChanged?.Invoke(this, new GladBehaviourValueChangedArgs(list.list));

                //WARNING: This call is needed to mark a scene dirty. There are cases where a scene
                //won't save the data if not marked dirty.
                EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
            }
        }
        /// <summary>
        /// Draws the View.
        /// </summary>
        public void Draw()
        {
            StringBuilder builder = new StringBuilder();

            UnityEngine.Object objectValue = objectValueProvider() as UnityEngine.Object;

            builder.AppendFormat("{0}: {1}->{2}", GetLabelName(memberName), objectValue != null ? objectValue.name : "", objectValue != null ? objectValue.GetType().Name : "");

            EditorGUI.BeginChangeCheck();
            objectValue = EditorGUILayout.ObjectField(new GUIContent(builder.ToString()), objectValue, serializedObjectType, true) as UnityEngine.Object;
            if (EditorGUI.EndChangeCheck())
            {
                OnEditorValueChanged?.Invoke(this, new GladBehaviourValueChangedArgs(objectValue));

                //WARNING: This call is needed to mark a scene dirty. There are cases where a scene
                //won't save the data if not marked dirty.
                EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
            }
        }