Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct here to familiarize yourself with the rules and how to post constructively.

  2. Unity 2022.1 is now available as the latest Tech release.
    Dismiss Notice
  3. Improve your project's performance with our new guide on profiling in Unity.
    Dismiss Notice

How do you code a tutorial level

Discussion in 'Editor & General Support' started by aero80, Nov 19, 2017.

  1. aero80

    aero80

    Joined:
    Jan 29, 2013
    Posts:
    27
    When I was designing my first game I also added a simple tutorial showing the basic mechanics. But that was a very simple one, tracking various status of the player and showing some text and ui animation at each one of these status.

    Now, I want to make a more detailed one for the game I am working on right now. I want to block actions before that tutorial part is actually completed, then when it is presented pause the game, wait for the action to complete and perhaps offer a retry if the action fails. But I can't figure out how to do this without touching my game logic or duplicating my code.

    So I was wondering how other people approach tutorial design. Do you just put the tutorial logic in the core game logic and skip presentation if its already completed (for example: "swipe to jump": check at each input if the tutorial is complete) or somehow is it possible to modularise every single bit so you can enable them one by one after each tutorial step.

    All ideas are welcome.
     
  2. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    5,870
    Event managers are your friends.

    https://unity3d.com/learn/tutorials/topics/scripting/events-creating-simple-messaging-system

    That way all you have to do is call events with 1 line of code from your game logic scripts, and your tutorial manager script (which is listening for the event) can do whatever fancy stuff needs to be done.

    You can also extend UnityEvent with up to four arguments to pass info to the tutorial scripts, or use delegates instead.
     
unityunity