示例#1
0
        void OnInspectorUpdate()
        {
            // Debug.Log("OnInspectorUpdate");

            if (!Application.isPlaying)
            {
                return;
            }
            if (mSerializedProperty == null || mSelectedIndexOfProperty == -1)
            {
                return;
            }

            if (mLogger == null)
            {
                mLogger = new VariableLogger(mSerializedProperty, 100);
            }
            else
            {
                UpdateSerialized();
                mLogger.SetLoggingProperty(mSerializedProperty);
            }
            mLogger.LogData();
            Repaint();
        }
示例#2
0
        void OnGUI()
        {
            EditorGUILayout.BeginHorizontal();

            // GameObject
            EditorGUI.BeginChangeCheck();
            mGameObject = (GameObject)EditorGUILayout.ObjectField(mGameObject, typeof(GameObject), true);
            if (EditorGUI.EndChangeCheck())
            {
                GetComponents(mGameObject, out mHasComponents, out mHasComponentNames);
                mSelectedIndexOfComponent = -1;
            }
            if (mGameObject == null)
            {
                return;
            }

            // Components
            EditorGUI.BeginChangeCheck();
            mSelectedIndexOfComponent = EditorGUILayout.Popup(mSelectedIndexOfComponent, mHasComponentNames);
            if (EditorGUI.EndChangeCheck())
            {
                // mHasComponentsがnullの場合は取得するような処理を挟んだ方がいいのかな?
                mSerializedComponent = new SerializedObject(mHasComponents[mSelectedIndexOfComponent]);
                GetProperties(mSerializedComponent, out mHasPropertyPaths, out mHasPropertyNames);
                mSelectedIndexOfProperty = -1;
            }
            if (mSelectedIndexOfComponent == -1)
            {
                return;
            }

            // Properties
            EditorGUI.BeginChangeCheck();
            mSelectedIndexOfProperty = EditorGUILayout.Popup(mSelectedIndexOfProperty, mHasPropertyNames);
            if (EditorGUI.EndChangeCheck())
            {
                // mSerializedComponentがnullの場合は取得するような処理を挟んだ方がいいのかな?
                mSerializedProperty = mSerializedComponent.FindProperty(mHasPropertyPaths[mSelectedIndexOfProperty]);
                mLogger             = new VariableLogger(mSerializedProperty, 100);
            }

            if (mSelectedIndexOfProperty == -1)
            {
                return;
            }

            EditorGUILayout.EndHorizontal();

            if (mLogger == null)
            {
                return;
            }
            var lastRect  = GUILayoutUtility.GetLastRect();
            var graphRect = new Rect(lastRect.x + 50, lastRect.y + 20, position.width - 58, position.height - 24);

            mLogger.DrawGraph(graphRect);
        }
示例#3
0
        public void OnInspectorUpdate()
        {
            if (mSerializedProperty == null || mSelectedIndexOfProperty == -1)
            {
                return;
            }

            if (mLogger == null)
            {
                mLogger = new VariableLogger(mSerializedProperty, 100);
            }
            else
            {
                UpdateSerialized();
                mLogger.SetLoggingProperty(mSerializedProperty);
            }
            mLogger.LogData();
        }