Beispiel #1
0
        public override void OnInspectorGUI()
        {
            //Draw the defualt inspector options
            DrawDefaultInspector();

            IntVariable script = (IntVariable)target;

            EditorGUILayout.BeginVertical(EditorStyles.helpBox);

            EditorGUILayout.LabelField("Debugging Options", EditorStyles.centeredGreyMiniLabel);

            EditorGUILayout.LabelField("Current value: " + script.Value, EditorStyles.boldLabel);

            EditorGUILayout.BeginHorizontal();

            //Display a int input field and button to add the inputted value to the current value
            intModifyValue = EditorGUILayout.IntField("Modify current value by: ", intModifyValue);

            if (GUILayout.Button("Modify"))
            {
                script.ApplyChange(intModifyValue);
            }

            EditorGUILayout.EndHorizontal();

            //Display button that resets the value to the starting value
            if (GUILayout.Button("Reset Value"))
            {
                if (EditorApplication.isPlaying)
                {
                    script.ResetValue();
                }
            }
            EditorGUILayout.EndVertical();
        }
 /// <summary>
 /// Add another sInt Value to the Value
 /// </summary>
 /// <param name="_value"></param>
 public void ApplyChange(IntVariable _value)
 {
     Value += _value.Value;
 }
 /// <summary>
 /// Set Value to another sInt Value
 /// </summary>
 /// <param name="_value"></param>
 public void SetValue(IntVariable _value)
 {
     Value = _value.Value;
 }