Reset script variable values automatically?

This is getting annoying- I edit a script in Unitron, I save it, and then I have to select the object (or objects, if several different prefabs share the script) it's attached to, click on the name of the script in the inspector, and select "reset" to get the variables to update.

I find myself having to do this a lot more than I would have to edit the value of a variable in the inspector. Is there an editor script or something to make it automatically reset all scripts every time you run the game?

2 Answers

2

Have a look at this function.

If you change the variable name, it will automatically reset :wink: