#How do I initialize variables just ONCE for the entire runtime?

1 messages · Page 1 of 1 (latest)

plucky siren
#

Still trying to understand the difference between start and awake https://docs.unity3d.com/Manual/ExecutionOrder.html
So start is called once, every time a scene is loaded? and awake is only called once in the runtime (lifetime) of the game?

(👋 still a beginner making slow progress here, sorry if this question is irritating because ive asked b4, but i just didn't get it)

#

How do I initialize variables just ONCE for the entire runtime?

worthy oyster
#

First Scene load is referring to when the scene is loaded, not only the first time the scene is loaded.

plucky siren
#

on scene load it resets to the initial start position. because start is called on load. but awake is also called on scene load?

worthy oyster
#

They are each only called once. Awake happens first, then OnEnable when the gameobject is activated, then start. If you deactivate then reactivate the object only OnEnable is called

plucky siren
#

ok thanks for the support. ill just type out the awake method in unity to see what is calls

worthy oyster
#

If you are still unsure then you can always use some Debug.Logs in each method to see when they are called

plucky siren