Handle Scene Transitions, Doors and Persistence like a Commercial Game

  Рет қаралды 7,694

Sasquatch B Studios

Sasquatch B Studios

Күн бұрын

Show your Support & Get Exclusive Benefits on Patreon (Including Access to this project's Source Files + Code) - / sasquatchbgames
Join our Discord Community! - / discord
The creation of this video started with a simple idea: I wanted to make a video showing people making metroidvanias how to handle scene transitions when they have multiple doors in each scene.
But...it kinda EXPLODED into this monster of a video.
SO! In this Unity tutorial, I wanted to show you how I handle everything in the most professional way I knew how - so basically, this video will show you how to handle: multiple doors, scene transitions, scene references and data persistence like a commercial game. And I say that with confidence, because these are the same systems I use in my metroidvania Veil of Maia.
I hope you enjoy!
Link to Download our FREE 2D Asset Pack:
veilofmaia.com/tutorial-asset...
---
In need of some Unity Assets? Using our affiliate link is a great way to support us. It's free, and we get a small cut that helps keep us up and running: assetstore.unity.com?aid=1100lwgBQ
---
Unity forum for the SceneField code:
discussions.unity.com/t/inspe...
Tarodev video showing his Initialization code:
• Project Initialization...
Contents of This Video: ------------------------------------------
00:00 - Introduction and Scene Explanation
01:26 - How I setup my Input
02:45 - Setting up the Interaction for the Doors
05:21 - Creating the editor script to handle serialized scene references in the inspector
08:40 - Setting up our Scene Management
10:31 - Setting up the Fade In and Fade Out
14:34 - Setting up Object Persistence
16:18 - Finishing the Fade In Method
17:41 - Spawning the player to the door when a new scene is loaded
19:13 - Improving the Persistence
22:03 - Disable player controls when entering/exiting a door
Who We Are-------------------------------------
If you're new to our channel, we're Brandon & Nikki from Sasquatch B Studios. We sold our house to start our game studio, and work full time on building our business and making our game, Veil of Maia.
Wishlist our Games:
Wishlist Veil of Maia! - store.steampowered.com/app/19...
Wishlist Samurado!
store.steampowered.com/app/23...
Don't forget to Subscribe for NEW game dev videos every Monday & Thursday!
Follow us on Twitter for regular updates!
/ sasquatchbgames
#unitytutorial #unity2d #unity3d

Пікірлер: 51
@Nathidraws
@Nathidraws 10 ай бұрын
Next tutorial: Why i started using Unreal Engine
@maciejtyczynski6836
@maciejtyczynski6836 10 ай бұрын
Anyone got a tutorial how to painlessly kill myself? 😂 I lost 3 years of my life and everyone is just like eh just switch engines MAKInG GAMES IS EASY xd
@Tertion
@Tertion 10 ай бұрын
Or Godot.
@ItsNothingAmazing
@ItsNothingAmazing 10 ай бұрын
Unreal is terrible for 2d so I think you mean Godot
@fireraccoon_
@fireraccoon_ 10 ай бұрын
I like it. I really like your tutorials. For me is ok how you presented it. As always i learn something new!
@lDeath489
@lDeath489 10 ай бұрын
I'm glad you keep doing progress despite the awful news. Whatever happen, you will overcome it and use it as a positive moment. Even if you had to move on to new engine.
@uxxix
@uxxix 10 ай бұрын
He probably recorded this in advance. Pretty tough spot.
@lDeath489
@lDeath489 10 ай бұрын
@@uxxix 😭 I'm sorry, I'm gonna go full preach mode xD. Ignore it if is annoying: The more the pain the better we become. That's why most amazing people are those who have the most painful and unexpected moments and yet they find peace in going through these tough times and they shape who they are instead of becoming weak. So I'm sad for situation but I'm not worried. Positive will begin to form and show up if we accept these struggles and learn from them.
@maciejtyczynski6836
@maciejtyczynski6836 10 ай бұрын
​@@lDeath489some will grow some will not. I feel like killing myself
@Change-jy1rl
@Change-jy1rl 10 ай бұрын
why is everyone such a drama queen
@lDeath489
@lDeath489 10 ай бұрын
@@Change-jy1rl sometimes that's what is needed for the moment. Sometimes it is annoying and unnecessary. So I understand.
@midniteoilsoftware
@midniteoilsoftware 10 ай бұрын
A good follow-up video would be how to use dependency injection for your "persistent objects".
@rubpty
@rubpty 10 ай бұрын
When having 2 PlayerInputs on the same scene, AutoSwitch no longer works because each Player Input "claims" a control scheme. My recommendation for the UserInput Class to work is, instead of adding a Player Input component to the UserInput Class gameobject and having a Static Reference to it, to have a Serialized Field private reference to the Player Input Component of the Player and get the InputActions references in Start instead of Awake to avoid null references.
@tinalava68
@tinalava68 5 ай бұрын
Thanks a lot! I really needed this video:)
@striferules
@striferules 5 ай бұрын
Passei muitos dias procurando como fazer isso, e esse tutorial me salvou. Parabens pelo grande trabalho! I spent many days looking for how to do this, and this tutorial saved me. Congratulations on a great job!
@WillisNP
@WillisNP 10 ай бұрын
This was a lot more complicated than I expected 😂. I did get a game transitioning from one scene to another while playing around with a few bits a few months ago, but I remember the coding being much simpler (though I imagine also a lot more limited than what you’ve set up, I.e. mine was just one door and it went from scene 1 to scene 2). I’ll have to watch this a couple more times I think to make sure I’m understanding it properly before I try to implement anything similar!
@Dedicatedfollower467
@Dedicatedfollower467 10 ай бұрын
Although I'm planning on moving away from Unity, I think the basic scripting principles behind this are really good and helpful!
@isleeg
@isleeg 3 ай бұрын
Is this really how they do it? Everything feels like we are fighting the system and creating unnecessary dependencies, but ey.... I haven't released a game...
@reuttal2633
@reuttal2633 7 ай бұрын
Really great
@felipezymor9970
@felipezymor9970 4 ай бұрын
10:56 if you use Mouse controls in your game, make sure to disable Raycast Target on the Inspector of the panel.
@st.altair4936
@st.altair4936 10 ай бұрын
Godot tutorials from now? 🤖🔪💠
@shitis7448
@shitis7448 8 ай бұрын
videazo🌹
@reglan_dev
@reglan_dev 10 ай бұрын
A little feedback: next time, you could include a "Unity Tutorial" word in your video's name, soo that everyone knows instantly that this is a tutorial video
@borisnaftaliev2911
@borisnaftaliev2911 10 ай бұрын
and its useless because of new Unity Runtime Fee; too bad
@ItsNothingAmazing
@ItsNothingAmazing 10 ай бұрын
​@@borisnaftaliev2911doubt that will even affect you.
@wokarol
@wokarol 10 ай бұрын
Hey, the Scene Field class does not appear to work when it comes to renaming the scene. The script renames the scene in the string field only if the editor for the object is open.
@bogoid
@bogoid 10 ай бұрын
dude not giving a single f*ck about unity going nuts❤
@zeldinus
@zeldinus 10 ай бұрын
He might have started editing the video before the crazyness went live.
@Neyavva
@Neyavva 10 ай бұрын
the first person in my mind after unity trndimg news , i feel soo sad for you. you and your wife lost many things to get into this after all the one thing which you trusted made this kind of step is soo sad , i know its very pain i want to cry for you , BUT i have to Say Just puk of evrything happend , past is past Dont leave our dreams by others mind: If you have to Achevie the Goal change the Strategy,Not the goal- by lord krishna
@noobdev6464
@noobdev6464 6 ай бұрын
How can this be used to spawn on the left or right to the portal instead of the middle of the portal
@xxleosk8xx
@xxleosk8xx 10 ай бұрын
Nice tutorial have you seen about this unity fee ??? 0.20 cents per install of the game even if some one keep reinstaling the game just for trolling the developer will have to pay for it this is crazy unity is going down the hill are you thinking about migrating your game to unreal ???
@ItsNothingAmazing
@ItsNothingAmazing 10 ай бұрын
That doesn't even affect most devs
@thewarden3140
@thewarden3140 6 ай бұрын
For some reason, when I tried the new Input setup, the controls are no longer detected. Any idea what I might be missing. I copied the UserInput script and in Player.cs used, for example, moveInput = UserInput.MoveInput.x;.
@antonio-abadfernandezhidal5422
@antonio-abadfernandezhidal5422 5 ай бұрын
I am having the same problem
@codered_dev
@codered_dev 10 ай бұрын
I love how you don't give a f***😂 this unity stuff won't stick
@sade1212
@sade1212 10 ай бұрын
Even if they try to walk back these changes, they'll just try them again but worse one, two, three years from now. Anyone starting a project in Unity now has to understand they're basically signing up to pay any arbitrary fee Unity invents in the future.
@reversamente
@reversamente 10 ай бұрын
Do you think it's really worth to make all this shenanigans to work around "dont destroy on load" what if you just let it be gone, and have a player on every scene? I don't see a point in keeping stuff as the same object. except something like a music player
@Fenga
@Fenga 10 ай бұрын
the dont destroy on load is to keep state. If you destroy and reload each scene the reloaded object will have whatever value was saved in the scene. IE you cannot keep persistance between scene loads.
@reversamente
@reversamente 10 ай бұрын
@@Fenga i don't feel like storing data on the game object itself is a good idea in most cases, only seems useful for music dont stop playing between scenes imo
@Fenga
@Fenga 10 ай бұрын
@@reversamente im curious, how do you then store gamestate between scenes ? Do you serialize to disk each load - i guess not, but im just wondering
@GnastyMusicTV
@GnastyMusicTV 10 ай бұрын
Does this mean you will still use Unity going forward?
@rafaelhuard
@rafaelhuard 10 ай бұрын
Oof timing.
@hldfgjsjbd
@hldfgjsjbd 10 ай бұрын
Some useful information, but misleading title. A lot of simplifications: you should use async scene loading, use animations for scene transitions, very bad limitation with door enums, and so on.
@owencoopersfx
@owencoopersfx 10 ай бұрын
I don’t think in this particular case that the door enum is a bad solution - enums can be bad when they might need to be expanded and you need to do more than a simple bool if the values are equal. As long as the check is just for equivalent value, then it’s easy to expand on it in the one place the enum is defined. Another solution over the enum would be ScriptableObjects. Make an SO type DoorID, and then you can just make the field holding that on each door readable and just check if the one assigned to the exit door matches that on the entrance door. But both are doing the same thing in essence.
@KoltPenny
@KoltPenny 10 ай бұрын
Please, we've heard about your difficulties in making your games so you guys can fulfill your dream. Heck, I could even offer to give you a hand, no cost, to move to something else but please, don't stay in Unity. It's a risk and it could become your worst financial decision. I'm not joking.
@maciejtyczynski6836
@maciejtyczynski6836 10 ай бұрын
Are you serious about that? Will you move my game to a different engine for free? Or are those just empty words
@KoltPenny
@KoltPenny 10 ай бұрын
@@maciejtyczynski6836 Who are you?
@PointFear
@PointFear 10 ай бұрын
Next vid: Why Unity is Bad
@platqr
@platqr 10 ай бұрын
damn you don't care don't you
@Coco-gg5vp
@Coco-gg5vp 10 ай бұрын
First
10 Unity Tips You (Probably) Didn't Know About
7:09
Sasquatch B Studios
Рет қаралды 7 М.
ОБЯЗАТЕЛЬНО СОВЕРШАЙТЕ ДОБРО!❤❤❤
00:45
ПРОВЕРИЛ АРБУЗЫ #shorts
00:34
Паша Осадчий
Рет қаралды 7 МЛН
Clown takes blame for missing candy 🍬🤣 #shorts
00:49
Yoeslan
Рет қаралды 46 МЛН
When Your Game Is Bad But Your Optimisation Is Genius
8:52
Vercidium
Рет қаралды 1,4 МЛН
CLEAN Game Architecture with ScriptableObjects | Unity Tutorial
13:12
Sasquatch B Studios
Рет қаралды 11 М.
The LIES You've Been Told About Gamedev
9:41
Sasquatch B Studios
Рет қаралды 10 М.
Unity Architecture for Noobs - Game Structure
16:24
Tarodev
Рет қаралды 191 М.
Mediator Pattern - Reduce Chaotic Dependencies
15:47
git-amend
Рет қаралды 7 М.
How To Escape Tutorial Hell
10:07
Sasquatch B Studios
Рет қаралды 7 М.
How I Would Start Gamedev (if I had to start over)
9:02
Sasquatch B Studios
Рет қаралды 18 М.
10 Unity Tips You (Probably) Didn't Know About
8:58
Sasquatch B Studios
Рет қаралды 10 М.
VR комната ( VR эксперимент/ MADiSON VR )
12:25
Майнкрафт, но я выживаю в ПВП ЦИВИЛИЗАЦИИ
30:33
Андрей Альварес
Рет қаралды 1,3 МЛН
РАТТЕ, почему ты меня ПРЕДАЛ?
5:04
• Gerand •
Рет қаралды 566 М.