How to save data between Scenes in Unity

preview_player
Показать описание
In this video I will show you 2 methods: PlayerPrefs and ScriptableObject solution to persist data between scenes in Unity.

First we will see how we can use the most basic way using PlayerPrefs and later we will explore how ScriptableObjects can help us to store the data between scenes without saving it to the Hard drive on your machine - which is especially helpful when building your game for WebGL.

Learn to make 2d games in Unity:

Unity 2017 scriptable Objects talk:

Join the discord:

You can support me through Patreon:

00:00 Intro
00:25 Using PlayerPrefs
03:04 ScriptableObject solution
08:51 Benefits of SO solution
09:28 Learn how to make 2D games in unity

#unity #scriptableobjects #playerprefs
Рекомендации по теме
Комментарии
Автор

Good to see a channel with new content! I used this in my game and it works great for keep track of my player's coins between scenes, even once you exit the game if you wish.

benjaminwillcox
Автор

Sir. Thank you very much, I have been searching a lot of time in YouTube but I got them in your video..❤❤❤

nomadparvez
Автор

Awesome tip! One deficiency though is that if you want to load a scene that doesn't require it and then switch back to another scene that DOES require it, unity might have garbage collected it. At this point is it best to just commit the value to a file, or is there a workaround other than requiring the object in every scene?

medthehatta
Автор

Finally someone made video on this thnx.
hi,
Kindly make more videos of unity challenges n other projects/tutorials for beginners
Thanks

harshjadon
Автор

Great video helped me a lot but something is not working for me when I try to save a 2D list do you know of any problem?

idanlevovsky
Автор

Thank you for this video! Works amazingly!

edplaying
Автор

It's good to see scriptable objects era..

eladonstar
Автор

im having this error : The type or namespace name 'FloatSO' could not be found (are you missing a using directive or an assembly reference?)

Subnow
Автор

Someone help me, just logic stuff. I plan make simple 2d like mario with scoring and has multiple levels. My problem is the leaderboard and its level selection. I would want to place the highest score of players on the board.

but the problem is how? Like i have multiple levels, so i do this?:

1.If i have like a level selection for ex level 1, it will get the highest score data i make and send it to level 2 then keep getting high score to reach for ex level 10 but the issue is level selection, what if i just restart different levels via level selection like i restarted level 2 and level 5 so the data changed right ? How do i keep tallying that like to the current level i had completed is like level 20.

2. For low levels (level 1-40)keep the scoring thing to a minimal like just increase 10 points. But at later higher levels make the scoring thing higher is this the right thing?

Someone help me. Thanks.

yeshacroe
Автор

how to persiste TExt componentes? in btween scenes? I need to pass the Text as welll (not only the data)...I need a starting point to every level , in every level I need some kind of thing to start eeverylevel to find text and avoiding Null reference in real time.

AstralNostalgia
Автор

I can't make a game without using So, they are a game changer when you unlock their power

pixelpat
Автор

does this works even if you reload the scene

charlespotvin
Автор

hey I used SO to save my float values. I build the game to my phone and tested it. When I restarted the scen(with a button) the values did not go deleted but when I closed the app and opened it again the values were gone(reseted). But in Unity editor this did not happy when I played the game and closed it the values did not go. please help thanks

dectly
Автор

this is good information but u gotta breath between your sentences when u talk m8. This is truly hard to follow. It's like an atomicbomb with information thrown at u all at once.

scarytoes