Skip to main content
Version: 2.0

Starting a Tutorial

There are multiple ways to start tutorials.

Using editor

You can set which tutorial to start when a scene starts inside of “General” settings. Make sure that Play on Start checkbox is checked and you should see a dropdown of all tutorials.

Next time you run your scene with a Tutorial Master Manager component enabled, a tutorial of your choice will start.

Using API

It's not always ideal to start tutorial when the game starts and therefore an API can be used to grant us greater control over that.

TutorialMasterManager includes a set of functions and methods that make it easy to do that. Therefore, you would need a reference to a TutorialMasterManager in order to access those functionalities.

Let's try replicating the editor script. Create a separate script (let's call it TutorialController). Include HardCodeLab.TutorialMaster namespace above and add the following:

using UnityEngine;
using HardCodeLab.TutorialMaster;

public class TutorialController : MonoBehaviour
{
public TutorialMasterManager tmManager;

void Start()
{
tmManager = GetComponent<TutorialMasterManager>();
tmManager.StartTutorial();
}
}

Attach the TutorialController to the same GameObject where TutorialMasterManager is residing in.

Start the game and the first tutorial should start!

This is great, but what if we want to go to navigate around tutorial with arrow keys?

Add an Update() method to our existing TutorialController script and populate it with the following:

using UnityEngine;
using HardCodeLab.TutorialMaster;

public class TutorialController : MonoBehaviour
{
public TutorialMasterManager tmManager;

void Start()
{
tmManager = GetComponent<TutorialMasterManager>();
tmManager.StartTutorial();
}

void Update()
{
if (Input.GetKeyDown(KeyCode.LeftArrow))
{
tmManager.PrevStage();
}

if (Input.GetKeyDown(KeyCode.RightArrow))
{
tmManager.NextStage();
}
}
}

Play the game again and now we can navigate around the tutorial with arrow keys!

Note that when you're at the last Stage of the Tutorial and call NextStage(), the Tutorial will stop.