Let’s make our game world a bigger place and connect the scenes.

To do this, we’ll use Spawn Points and Scene Changers. You can learn more about them in this how-to.

Town scene

First, open the town scene (1 Town). Use the ORK Scene Wizard to create a Spawn PointCreate Object > Spawn Point. The new spawn point will automatically receive the Spawn ID 1, since we already have a spawn point in the scene (ID 0). Place the spawn point at the entrance of the scene (the road).

Now, again use the scene wizard to create a Scene ChangerCreate Object > Scene Changer. Also place the scene changer at the entrance of the scene.

gametutorial_5_connecting_the_game_world1

Place the spawn point and the scene changer so that the spawn point is not within the Sphere Collider of the scene changer. If it’s too close to it, the player will spawn in the scene changer and immediately change scenes again.

Change the following settings in the scene changer’s inspector.

Scene Settings

  • Target Scene
    Change to 2 Field (the name of the field scene where we want to change to).
  • Target Type
    Set to Spawn ID.
    We want to spawn using a spawn point.
  • Spawn ID
    Set to 0.
    We haven’t added a spawn point to the field scene yet, so it’ll get the ID 0 once we place it there.

The rest of the settings should be good as they are – check if the Start Type is set to Trigger Enter.

Save the scene.

Field scene

Open the field scene (2 Field). Move the scene view so that you see the mountainous region where the road leaves the scene. Create a spawn point and a scene changer there.

gametutorial_5_connecting_the_game_world2

Check if the spawn point has the Spawn ID 0 and change the following settings in the scene changer’s inspector.

Scene Settings

  • Target Scene
    Change to 1 Town (the name of the town scene where we want to change to).
  • Target Type
    Set to Spawn ID.
    We want to spawn using a spawn point.
  • Spawn ID
    Set to 1.
    That’s the ID of the spawn point we created in the town scene.

Sphere Collider

  • Radius
    Set to 5.
    Since the way is broader here, we want to cover the whole way with our scene changer.

Save the scene.

Time to test – change to the main menu scene (0 Main Menu) and hit play. You’ll now be able to change between the scenes by walking into the scene changer. The screen will fade out before changing the scene and fade in after changing scenes.

You might notice that the player is faced in the wrong direction after spawning in the field scene, let’s fix this! Open the field scene (2 Field) and select the spawn point. Change the following setting in the spawn point’s inspector.

Transform

  • Rotation
    Set Y=180.
    This will turn the spawn point by 180 degrees.

Spawn Settings

  • Use Y Rotation
    Enable this setting (it’s enabled by default).
    The player will use the spawn point’s Y-axis rotation (the one we changed).

Save the scene.

Again, let’s test – change to the main menu scene (0 Main Menu) and hit play. When walking into the scene changer in the town scene, you’ll see that the player will now face in the right direction after spawning in the field scene.

And that’s it for now – the next lesson will cover music and the music player.