Hi guys,
I want everytime game is started, a script is called. Its not awake() or start(), that when you want everytime a scene is started, not a game.
I have try’d using playerpref.haskey(“Sound”), but the next time game is loaded that script is not called (because “Sound” is exist, and i dont want a script that delete a key since player usually close a game using alt+f4. Unless somethin i dont know happen there).
Any advice?
If you want something to fire every time a scene has completed loading, this is the reference method to use:
You subscribe a delegate to that event (just once!) and then Unity will call your delegate every time a scene has loaded. There’s some example code in the above reference.
Obviously all DontDestroyOnLoad() caveats apply: make sure any object your delegate is located on does not evaporate during scene changes, or else it won’t work!