- Home /
Saving default transform of an object c#
Hi, my Object scales everytime it is hit by another object with specific tag.. and if i want to reset the game - here's the problem = I need to scale it down to the default scale in game (in script). Is there a way to store and than call the default scale of an object? For the scale.. im using transform.localScale. Thx for help
Answer by Prastiwar · Feb 11, 2018 at 02:15 PM
Make variable Vector3 baseScale
which'll store base scale, assign it in Awake
and then when you reset game just make transform.localScale = baseScale
;
Can i assign it in Start() is it the same? If not what's the difference? Sorry im a begginer doing his second game.
If the localScale is not changed until Start() is called, then yes, you can assign it there, or in Awake(). If you make "baseScale" public, you should see the assigned value it in the inspector when you start the game.
Yes, there is the differences between Awake and Start descripted. It's just execution order.
Your answer
Follow this Question
Related Questions
2DHingeJoints not flipping with characters localScale C# unity ragdoll 1 Answer
Distribute terrain in zones 3 Answers
Multiple Cars not working 1 Answer
Player changes scale when i play the game 1 Answer
Object's localScale 1 Answer