How to Send Variables Between Scenes in Unity

preview_player
Показать описание

In this video we will be taking a look at how to send variables between scenes in Unity. Ultimately, sending variables between scenes isn't too different from sending variables between scripts in Unity.

Ultimately, what we want to do is make sure we have a centralized location where we can send those variables to temporarily stay while the new scene loads. Once that new scene loads, we can send variables between scenes by calling them back.

There are a few ways to accomplish sending variables between scenes. In this case, we'll be using a static string to transfer a difficulty setting. However, you can accomplish this same thing with enums or private non-static variables.

_________________________________________________________________________

Support:

_________________________________________________________________________
Рекомендации по теме
Комментарии
Автор

THANK YOU! Total beginner here and I was getting very frustrated. It felt like everything I tried to do ran into the issue of a script or scene not being able to access the information that it needed. This is going to make things so much easier.

jw
Автор

Thanks for this, all of the other tutorials are the same copy paste setting of quality, resolution etc and don't handle making variables available for game objects, this is really useful.

happymnky
Автор

DUDE you are a life saver, thank you very much. Hoping you're having a good time. Keep it going.

thellamaamanda
Автор

Thank you very much !
I didn't even know how to properly express my problem to find the solution, but was ablr to find your video!
Great explanation, bravo!

andrewsemenenko
Автор

thank you i love you this helped me make a working score system that saved the score during the game over scene

oliviad
Автор

didnt realise it was that simple! Thanks for this

Alex-hfzy
Автор

thats exactly what i was looking for, you saved my ass

boritotv
Автор

i like this so much cuz finaly i understood what static is doing . ty man <3

NeleN_Games
Автор

Just what I needed. Thank you so much!

oedipascourage
Автор

Thank you so much man, I really appreciate your help!

tunailker
Автор

Thanks for his video. Very simple and very helpful!

Luvseatshawty
Автор

thanks bro, this was better and more performance than DontDestroyOnLoad methods.

Luluskuy
Автор

And what about int, float and other because using static it will not allow you to change anymore so you need to manually assign it for example public static int coinsStatic;
public int coins;

void Start()
{
coinsStatic = coins;
}

But the problem is that how we can pass variables through scriptable object after using a singleton through other Mono behaviour scripts without attach them after scene change

spectrumRoyale
Автор

used this tutorial to make a basic options screen for my game, thank you! it finally works.
however, i have one question: how can i make the variables carry over when the player goes back to the main menu? (check boxes and sliders have the same values as set by the player)

Bonnie
Автор

What's the use to inherit StateNameController from MonoBehaviour if you dont attach it to any gameObjects?

rpimxoimxo
Автор

thanks for this. I'm just looking for how to get user input and display in next scene but i saw your video and give me some hint.

hengpisey
Автор

can you make a video on the same ussiu with netcode?... thanx for your work!

NLPIsrael
Автор

Great video man, glad I subbed. Can I ask, can this method also be applied to collected coins shown in a level and in the main menu?

qqq
Автор

thx i was making a battle system in my game but didn't want to make a million scenes for each battle

bigmancozmo
Автор

Nice video, but how about if we using playerprefs? & wich one is better? or wich one should we use?

sajidgame
welcome to shbcf.ru