How to reset already initialized variables individually through the inspector
Hi, This is really frustrating me as for the life of me, every single question phrased like this is not exactly what I am looking for. So I have made a script that initializes some public variables after which show up in the inspector.
I am aware of the fact that you are able to reset all of a scripts variables back to their defaults with the Reset button:
But I have a bunch of other variables that I do not want to reset back to their original values as they are linked to other things, or have values that I already am satisfied with. I have tried right clicking on the terms themselves to try and see if I could get a reset button for the variable itself but to no avail.
Short of deleting the original initialized variable in the script, saving said script, and then adding it back in and saving it again just to get the default value back (Because that's tedious to have to do that every time you want the default value back if its already baked into the code), how would one go about resetting them individually?
I am sure its something really obvious that I am missing XP
P.S. To be clear the default values are not 0 for the last 4.
Answer by hendryshaikh2004 · Oct 15, 2020 at 07:32 PM
Reset component from the 3 dots on the top right corner
Thanks for the suggestion, but unfortunately thats not what im looking for. As stated in my post above,
I am aware of the fact that you are able to reset all of a scripts variables back to their defaults with the Reset button: But I have a bunch of other variables that I do not want to reset back to their original values as they are linked to other things, or have values that I already am satisfied with.
As it stands I am looking to reset one variable of the script rather than every single one displayed.
You can copy the component values and paste them after resetting if it helps please upvote.
Answer by Immersive_Display_Solutions · Apr 22, 2021 at 09:08 PM
Making the variable static, saving and letting unity reload, changing it back to nonstatic, and saving and letting unity reload again fixed the issue. In my case it was a serialized class reference.,Making the variable static, saving, and then making it nonstatic worked for me. In my case the variable was a serialized class reference.
Your answer
![](https://koobas.hobune.stream/wayback/20220613002941im_/https://answers.unity.com/themes/thub/images/avi.jpg)