Switching scenes

To keep working on your game manageable, it's a good idea to split up your game's locations into as many scenes as possible. It's common for adventure games to separate each room or location in a separate scene file.

There are quite a few options at our disposal when switching scenes, and this tutorial will cover them.

The basics

When you switch scene, Adventure Creator will position the Player at an appropriate PlayerStart object. PlayerStarts can be created from within the Scene Manager, underneath the Navigation panel:

A PlayerStart's Inspector window contains fields that allow you to choose from which scene the Player must have come from for this PlayerStart to be used. For example, this PlayerStart will only be used if the Player's previous scene was named "Shop":

You may have noticed the Default PlayerStart field in your Scene Manager. You can have as many PlayerStarts in your scene as you like - but if AC can't find one that matches the Player's previous scene, then the default one will be used instead.

To switch scene, simply call the Scene: Switch Action as part of a Cutscene or other ActionList:

Adding a transition effect

By default, the screen will turn black for a short duration while the next scene is loaded. However, it's possible to add some nicer transition effects for a more polished feel.

For example, by using the Camera: Fade Action to fade out just before the scene change (and another one to fade back in afterwards), we can fade to black, and then back again:

Or, we can remove the transition completely, and just have a straight cut from one scene to the next. We can do this by checking Overlay current screen during switch? in the Scene: Switch Action. This will make AC take a screenshot of the first scene, and overlay it during the switch:

For a crossfade effect, we can combine this option with a Camera: Fade Action in the new scene. If we overlay the first scene, and fade in at the start of the second, the camera will crossfade.

Loading screens

We can also dedicate a specific scene in our project to be used as an "interim" scene when switching from one game scene to another. This is useful if our scenes are large and take a while to load, since we can place graphics inside this interim scene to tell the user that the game is loading.

With a loading scene created (in this case, named LoadingScene), add it to Unity's Build settings (File -> Build Settings), and then check Use Loading screen? within the Settings Manager. You can then enter in the details of the scene to use:

We can also make use of progress bars to give the user an idea of how long the loading will take. See this tutorial for more on this topic.

Positioning the Player relatively

A new feature in AC v1.49 is the ability to position the Player relative to a Marker in the previous scene. This is useful if we have a very wide area that the player can step on to trigger the next scene.

As an example, consider the following scene:

If the Player steps on the red Trigger, then they'll be taken to the next scene. Since the Trigger is very wide, we'll want the Player to be on the same side of the screen after the scene change. For example, if they step on the left side of the Trigger, we want the Player to appear to the left in the next scene.

We can do this by creating a Marker that the Player will be placed relative to in the next screen. First, use the Scene Manager to create a new Marker, and place it in the centre of the Trigger:

Then, within your Scene: Switch Action, check Position Player relative to Marker?, and assign your new Marker as the Relative Marker:

The Player will still use the next scene's PlayerStart as the "base" position, but the relative position between the Player and this Marker will also be accounted for. It's a bit of a tricky concept to grasp, so try it in practice and see the result for yourself!

Adventure Creator and this website are copyright Chris Burton, ICEBOX Studios

Go to top
Do NOT follow this link or you will be banned from the site!