The Path of the Game Dev — Day 25

Saving progress…

— —

Despite only taking the first half of the day to work on Unity projects, I managed to get a lot done! A quick overview of the sections completed today:

  • Stealth Game and Cinematography
  • Main Menu
  • 2.5D Platformer
  • Intro & Setup
  • Player Movement
  • Collectibles

One thing I wanted to write up on was Scene Management and AsyncOperations. We had a taste of it in the 2D Space Shooter game when we had to set up the main menu. But the stealth game also has us transitioning from the main menu to a loading screen before we get to the main game screen.

Let’s walk our way through making a main menu screen with the options to Start and to Quit. To transition between scenes in-game in Unity, you first need to add all of your scenes to your Build in Build Settings (otherwise you won’t be able to get a reference to the other scenes). Once you do this, you can start setting up your menu by adding

using UnityEngine.SceneManagement;

in your main menu script. Think of this as your library card — it allows you to access the information Unity’s SceneManagement namespace provides. The most useful method we’ll use for this is the LoadScene method, which does exactly what it says on the tin. Make sure you pass in either the name of the scene you want to load through a string or the scene number that appears in the Build Settings.

The last step is to create the proper functionality on the buttons in the menu. These buttons should be children of the Canvas and your main menu script should be a component on the Canvas. When you select the buttons there should be an option in the Inspector to put in an On Click() function — add to the list, put the Canvas object where it asks you to select an object, and then select the method you want to call from the drop down menu on the right. It’s really easy!

When using a LoadLevelAsync coroutine, you can even track its progress until completion, which is extremely helpful when creating load screens!

Biggest takeaways from the day: AsyncOperations are intimidating at first, but with the right practices, can be invaluable to your code.

— —

Progress saved!

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Product innovation looks like a “mission impossible”

When I typed aatalyk in Google

AMA Recap: Decentralized Club & MetaMerge

Turning Looker Up to 11

Java IO Tutorial — Java InputStream

Problem Solving for Engineers: Modelling and Simulation

Is Writing a Book Similar to Developing Software?

Elixir in a nutshell

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Gabrielle Igarta

Gabrielle Igarta

More from Medium

Procedural Content Generation through a Data-Driven Approach

Thoughts on Current Computer Games

NO.4 Rhapsody—About a small party game I made

My first level design experience — few tips and tricks to build nice levels.