Handle Scene Transitions, Doors and Persistence like a Commercial Game

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

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:
---
---

Unity forum for the SceneField code:

Tarodev video showing his Initialization code:

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 Samurado!

Don't forget to Subscribe for NEW game dev videos every Monday & Thursday!

Follow us on Twitter for regular updates!

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

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.

lDeath
Автор

Next tutorial: Why i started using Unreal Engine

Nathidraws
Автор

Amazing, love how your brain thinks. So grateful for your videos sir.!

SextonDoug
Автор

I like it. I really like your tutorials. For me is ok how you presented it. As always i learn something new!

fireraccoon_
Автор

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!

striferules
Автор

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!

WillisNP
Автор

Although I'm planning on moving away from Unity, I think the basic scripting principles behind this are really good and helpful!

Dedicatedfollower
Автор

A good follow-up video would be how to use dependency injection for your "persistent objects".

midniteoilsoftware
Автор

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.

rubpty
Автор

Thanks a lot! I really needed this video:)

tinalava
Автор

10:56 if you use Mouse controls in your game, make sure to disable Raycast Target on the Inspector of the panel.

felipezymor
Автор

dude not giving a single f*ck about unity going nuts❤

bogoid
Автор

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

reglan_dev
Автор

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...

isleeg
Автор

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

Neyavva
Автор

How can this be used to spawn on the left or right to the portal instead of the middle of the portal

noobdev
Автор

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 ???

xxleoskxx
Автор

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;.

thewarden
Автор

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.

wokarol
Автор

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

reversamente