How to make a Save & Load System work across Multiple Scenes in Unity | 2022 tutorial

preview_player
Показать описание
In this video, I show how to make a Save & Load system work across multiple scenes in Unity. The tutorial demonstrates this by adding a main menu scene and allowing the player to start a new game or continue a saved game.

Thank you for watching and I hope the video was helpful! 🙂

► SAVE & LOAD SYSTEM TUTORIAL PLAYLIST
The full Save & Load System tutorial playlist that this video is part of can be found here.

► TIMESTAMPS
0:00 Intro
0:54 Recap of Save & Load System
2:05 How Scene Transitions Work
3:24 How DontDestroyOnLoad Works
4:20 Project Overview
5:02 Turning the DataPersistenceManager into a Prefab
5:29 Creating the Main Menu Scene
10:00 Adding the sceneLoaded and sceneUnloaded events
12:35 Transitioning from the Main Menu Scene
15:00 Adding DontDestroyOnLoad
16:46 Small changes to LoadGame and SaveGame
17:58 Disabling the Continue Button
19:02 Playing from any Scene in Development
20:36 Outro

► RESOURCES
DontDestroyOnLoad documentation

SceneLoaded documentation

SceneUnloaded documentation

Excellent introduction tutorial to Unity’s new Input System

► GITHUB PROJECT
The '2-save-load-implemented' branch is the starting point of the project for this tutorial and the '3-load-across-scenes-implemented' branch is the end result.

► MUSIC
The backing music is custom made by @themaykit.

► DISCORD
Come ask questions, suggest a video topic, or just hang out!

► THE PATH OF REN
Wishlist 'The Path of Ren' on Steam!

► SOCIAL MEDIA LINKS
Follow my current project!

► SUPPORT
Any support is much appreciated! I may receive a commission on any assets purchased using the below Unity Asset Store link.

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

Thanks for watching! 🙂There's an *_issue_* with using _sceneUnloaded_ to Save the game that I overlooked when making this tutorial. If you're experiencing trouble with data being saved when transitioning from your gameplay scene (for example, back to the main menu), read the below.

Because of how sceneUnloaded works, it triggers *after* everything in the scene has already been destroyed. Since we're calling SaveGame() in there, the IDataPersistenceObjects it would have called to update the GameData will already have been destroyed - hence the data would not get updated.

The *_fix_* for this is to call SaveGame() anytime right before you load a scene rather than through the sceneUnloaded event. This will ensure data is Saved before the scene transition rather than afterwards.


ShapedByRainStudios
Автор

I'd love to watch an Additive Scene Loading video from you. Thanks for your brilliant work. It helped me a lot.

reaware
Автор

You have been a great help these tutorials are quick and to the point, but at the same time easy to follow along with. Thank you for your help

logicalchaos
Автор

Some of the best videos I have found, thank you so much for all the time you put into helping others with their projects!

gamemacher
Автор

Many thanks Trever. Loved the tutorial!

lolaswift
Автор

amazing tutorial as always! Thank you so much! Also would love to see how your workflow works with additive scene loading! Thank you for making this <3

AndrewGiacomoPinnical
Автор

Speaking with no break is a bit difficult for a non-native English speaker to understand....BUT, YOUR TUTORIAL SAVE MY GAME! I give you big thanks!!!

nishaqiao
Автор

thank you very much, u show the solution I was looking for for a last few days

disturbing
Автор

This is a complete usefull tutorial, i can never express my gratitude or thank you enough for such GREAT series. May God bless you in this Life and the after👍👍☺️😄

DZIRISOFT
Автор

Excellent video! Some of the highest quality Unity content I’ve seen. Path of ren looks sick too :) Huge fan of yours; keep up the awesome work!

dandiuszielth
Автор

there is literally no words that can thank you enough for this video and your previous video on save systems but thank you for making a video with the git available so we can all see the code and take time to properly understand it I personally have been struggling to get a working save system implemented for the last 6 to 8 weeks for about 8 hours a day ("i know its not that hard now I'm new to unity and c# coding") but you have ended my struggles thanks to your tutorial and the git so that i could study the code and see how everything was working and I'm pleased to say that within a couple of hours with your tutorial i have successfully created and implemented my own version (largely similar to your version) of a save system with full understanding of how it works as opposed to what most tutorials do and say this is how you do it bye even assets for saving i couldn't understand until your videos thank you one more time please keep up the awesome stuff you do

mightyminigamer
Автор

I like your style and way of teaching, clear and to the point. Thanks! Please keep up the good work.

elvinchen
Автор

Just implemented this into my game im working on! Thank you for this!

Breckdareck
Автор

Straight to the subject, this was a confusing topic for me but this video made it seem simple. Best teacher on yt 😁

MrJMM
Автор

This is by far the best structured and thought out tutorial I have come across regarding unity, regardless of the topic!
It would be awesome to see more, especially the additive scene loading
Keep up the awesome work

MrHump
Автор

that would be amazing if you would make a video for additive scenes too. However, i still might use this tutorial, coz my game has both additive and single scenes.

reglan_dev
Автор

Thank you so much! With this video I was able to complete a final for my class

theanonimoable
Автор

Really helpful, thanks! You earned yourself a sub

EgyptianViking
Автор

Thank you! Great work. Big help to my game. I also just joined your discord.

rdperson
Автор

How does this channel not have more subs?! Great job!

DinoSharkCobra