Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Assets/Editor/TestEditor.cs
- using UnityEngine;
- using System.Collections;
- using UnityEditor;
- [CustomEditor(typeof(Test))]
- public class TestEditor : Editor {
- private void Reset()
- {
- Debug.Log("Reset");
- Test test = (Test)target;
- test.SetVal(5);
- }
- }
- // Assets/Test.cs
- using UnityEngine;
- using System.Collections;
- public class Test : MonoBehaviour
- {
- [SerializeField]
- private int myVal;
- public void SetVal(int val)
- {
- myVal = val;
- }
- private void Start()
- {
- Debug.Log("myVal: " + myVal);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement