Skip to content

Tutorial System

caxawu edited this page Aug 16, 2020 · 3 revisions

Setting up a new tutorial system

  1. First ensure that there is a Dashboard Controller in the scene. If not, find the Dashboard Controller prefab under Assets -> Prefabs -> Dashboard -> Dashboard Controller and drag it into the scene under the LeftControllerAnchor.
  2. Drag a Tutorial Controller prefab into the scene. This prefab is found under Assets->Prefabs->Dashboard->Tutorial Controller.

Tutorial Step

The TutorialStep.cs script is the base class for all the steps of a tutorial.

Deriving from TutorialStep

Create a separate script for each step of your tutorial (switch vision, grab, teleport, etc.) All your tutorial scripts should derive from TutorialStep and not from Monobehavior.

public class LobbyPress : TutorialStep

By deriving from TutorialStep, your script will have a few parameters already in the inspector:

  • Dashboard Text: Fill in this text box with the text you want the dashboard to display during this tutorial step.
  • Allow Active False: If this is checked, the gameobject that your tutorial step script is attached to will be turned off when the player is not on this step.

Setup and Cleanup

In your tutorial script, you must implement:

Setup

public override void Setup(TextMeshPro TMP)

This is where this particular step's relevant gameobjects are turned on, listeners attached, etc. This function is called when this particular step is activated. Make sure to include TMP.text = dashboardText; to update the dashboard text to the text inputted under Dashboard Text in the inspector.

Cleanup

public override void Cleanup(TextMeshPro TMP)

This is where the relevant gameobjects are turned off, listeners detached, etc. This function is called when this particular step is deactivated.

OnDone

OnDone.Invoke(); needs to be called when the player has completed this step in the tutorial so that the TutorialController script knows to move on to the next step.

Tutorial Controller

The tutorial controller prafab is an empty gameobject that contains TutorialController.cs. This script works in conjunction with TutorialDashboard.cs which is attached to the Tutorial Dashboard object parented under the Dashboard Controller.

The TutorialController.cs script takes in multiple parameters:

  • TMP: TMP refers to the TextMeshPro component that will display the text on the dashboard for each tutorial step. Drag in the Dashboard TMP parented under the Tutorial Dashboard into this slot.
  • Tutorial Steps: This is an array of all your individual tutorial steps.
  • Skip Button: A reference to the Skip Button object parented under Dashboard Controller -> Tutorial Dashboard -> Skip Button.
  • Camera Rig: A reference to the OVRCameraRig. Used in conjunction with the spawn point.
  • Spawn Point: An empty gameobject whose transform is where you want the player to move to.
  • Move To Spawn: A boolean that, if true, moves the Camera Rig (player) to the Spawn Point if they press the skip button (example: move the player to the main animal island in the lobby if skip is pressed.)