Reset a script's variables to their initial values

Hi there!

Anyone know an easy way to reset a scripts variables to the values that were initially set at?
I’m trying to reset a character and I don’t really wat to have to go through an reset all of it’s variables manually.

Thanks
Pete

Click the little gear icon and choose reset.

–Eric

Oh no,
I was looking for a way to reset it mid way through the game :slight_smile:
When my character dies I reset it back to the start position and I have to reset all of it’s script’s variables to what they were initially set to. It’s kinda tedious and messy to go through and manually reset each one, so I was hoping that there might have been a function that would have the same effect as you described but that could be called during the game.

You could always destroy the character and instantiate a new prefab.

–Eric

Yeah, I was trying to avoid that as it causes a bit of a hitch at a bad time in the game. I was thinking that maybe I could just destroy the script component though and add it again as a component, that might work.

Sounds reasonable to me.

–Eric