|
I need to expose a variable on the inspector. But when I change that variable through the inspector, I need other things to happen. So I tried making a setter for that variable. But when I change that exposed variable, it gets changed directly and the inspector bypasses the setter. Is there a way to force the inspector to use the setter? Or is there another way to force things to happen once a variable gets changed in the inspector? Thanks in advance! Cheers!
(comments are locked)
|
|
I would write a custom inspector for this problem. To start off you would write your normal Monobehavior script like the following and attach it to a gameObject where you will be able to see the public property visible. But when you get/set the value the Debug.Logs inside Setter/Getter would not print. Now you have to create a custom inspector like such to take advantage of your getter/setter. like I explained in the comment, you could take out the 'button' line in the inspector code ( Very neat! I really appreciate the help. Thanks for taking the time! :)
Aug 04 '12 at 01:17 AM
Filippopotamus
No worries. Glad to be of help.
Aug 04 '12 at 01:29 AM
hdsenevi
for publicVariable property in first class you need to include [SerializeField] attribute on it
Oct 10 '12 at 10:25 AM
nicloay
(comments are locked)
|
