How to transfer values between scenes?

I would like to know if there any way ( I´m pretty sure there is) to transfer a value between scenes ? I would like to move the guess value to the win scene.

You could create a game manager and use dontdestroyonload() to carry it from scene to scene.

1 Like

Thanks for your anwer but could you please explain how to do that ?

Can I point you to video 70 in the 2D course, Singleton patterns and 81 in the 3D course playing music between scenes.

Sorry I can’t really help further this evening, I am getting ready for the gamedev.tv community podcast recording in a bit. But if you need further assistance I can later.

Basically you are creating a game object with a script that had the don’t destroyonload function so that it can persist between scenes. I could carry any data you want to move forward like a score, player stats or a music player for consistant music from one scene to the next.

1 Like

Thanks again for your answer, but for what I´ve seen, I should wait till that point inside the course, I might guess that I am anticipating myself… I will check that info!!!

@Nina Thanks for the grammar correction!

It wasn’t a grammar correction, just a tiny typo I fixed so other students can find your thread when they type “transfer”. Your question was an interesting one, and I’m sure other students would like to know the answer, too. :slight_smile:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms