Multiscene workflow in Unity - RotW DevLog #6

Published January 27, 2024
Advertisement

Here I am again, slowly getting back into the swing of things. One thing I have been long curious about and have kind of been working on in the background is - how I can better exploit a multi-scene workflow.

In the clip above I have thrown together a UI Toolkit main menu (its still WIP, be gentle) which when you click the play game button it loads both the initial game level and the player using a coroutine (below)

This is again, something that is WIP - I need to build a proper loading screen to avoid the camera not rendering prompt. Once loaded you take control of the player, running into the grey sphere to test the health system. Moving through the scanner kicks of the load for the main part of the level. once loaded the door is supposed to open, but there's something else going on with the animation that I need to look into. once through that door you pass through another trigger that closes the door behind you and unloads the first part. By the end of the video there are four scenes loaded into the game.

At the moment there a three core scenes in this workflow;

  • The Core Loader.
  • The Player.
  • The Level(s).

The Core Loader holds all of the game level persistent data - inventory, ammo count, level progression, menus, audio etc - basically everything that needs to be available all the time. This scene is the only one loaded up when the game is started and everything hangs off this with every other scene being loaded additively to the core loader.

The player scene, allows for total disconnection of dependencies at the game level - everything that revolves around the player is here - health, stamina, cameras and….err…. that's about it, well of course there's the model and animations too but overall that's really it. on player death the scene can be reloaded to reset the attributes without affecting any other system and avoids additional logic to retain/reset the health system on its own. Of course there are probably better practices and I'm always open to learning but this is how I'm going about it at the minute. Having the player as its own scene also offers up the opportunity to export as a package and use in other projects straight out the box - everything already works, cameras, health. What's not to love about that? All my games will have the same player feel!

The Level - well, its the game level isn't it! This scene holds all of the level associated logic, enemies, puzzles, collectables - all in here.

Originally I was going to use the old style loading screen between each section of the game, but modern gamers are spoilt with emersion systems and for a better experience I'll load in and out the scenes as appropriate and asynchronously. using multi scene workflow also feeds my massively disjointed mindset too - having elements separated out means I can work on one part, I'll get bored, move on to something else in another scene get bored of working that piece and move onto another - rinse and repeat, but because of the smaller ‘compartments’ nothing really gets out of hand! haha!

Going forward I need to sync the lighting settings across scenes and finish the other triggers across the rest of the level. things are progressing well.

Thanks for reading, I welcome all comments, questions and/or suggestions. Until next time.

1 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement