One-Time Tutorial



  • Hi,

    I was trying to set up the one-time tutorial, but I'm getting an error, and I'm not sure what to insert to properly make sure the tutorial doesn't play again. I tried to follow the pdf instructions, but perhaps you can clarify.

    I called my tutorial,"ChooseLevel."

    Then, I created a script and inserted this code:

    `using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using TutorialDesigner;

    public class OneTimeTutorial : MonoBehaviour {

    GameObject TutorialSystem;
    
    // Use this for initialization
    void Start () {
    	GameObject TutorialSystem = GameObject.FindObjectOfType("TutorialSystem");
    }
    
    // Update is called once per frame
    void Update () {
    	CheckForFirstPlay ();
    }
    
    public void CheckForFirstPlay()
    {
    if (TutorialSystem != null) {
    	SavePoint TDSavePoint = TutorialSystem.GetComponent<SavePoint> ();
    	if (TDSavePoint.oneTimeTutorial && TDSavePoint.IsTutorialDone ()) {
    			LevelSelectTutOver (); //don't play tutorial if it already played once
    }
    }
    

    }

    public void LevelSelectTutOver()
    {
    	TutorialDesigner.ChooseLevel.Global.SetActive(false);
    }
    

    }`

    What am I missing here?

    Thanks,
    Milan



  • Hi Milan,

    the command should be: GameObject.Find("TutorialSystem");

    If you want to set it by code. But I would recommend, setting it by StepNodes. Documentation Page 16. This is the easiest way.

    Best,
    Michael



  • Hi Michael,

    Thanks, but I'm still having a bit of trouble. For clarification, where do I put the node? I created a new step and dragged in the Tutorial System as the directions stated. Then, I set it to SavePoint.WriteTutorialDone. I tried it at the end, as the last step, and at the beginning, as the first step. I even tried it checking and unchecking the bool that makes it either local or global. But whenever I move to a different scene and then reload that first scene the tutorial still starts up again. I'm clearly still doing something wrong here. Any suggestions?

    Thanks,
    Milan



  • Hi Milan,

    it's much easier than coding it this way. My suggestion would be:

    1. You define one Point in your game where you consider the tutorial done. That's where your StepNode should be with the "WriteTutorialDone" Function.
    2. After that you can verify the PlayerPref Key on the TutorialSystem GameObject. An Example is in the included Soccer tutorial. See Screenshot:
      http://fs5.directupload.net/images/170418/temp/cc8oilf8.png
    3. Simply put your "LevelSelectTutOver" function into the "Alternate Event" Section. When the tutorial was already done, this Event will be executed instead of the tutorial.

    I hope that helped.
    Best, Michael



  • Hi Michael,

    I tried using the Soccer Tutorial as a reference, but for some odd reason, it's acting funny. It doesn't show any nodes and says it's missing a node. I tried to create a new step or event node, but it doesn't respond to my clicks. Also, I'm having trouble with the Player Prefs and saving keys to it. Not sure why all of a sudden. And every time I try to type in 'TDesigner.[TutorialName].Global' it turns red in Monodevelop. If I use TutorialDesigner it works fine, but TDesigner doesn't. Any clues on why this might be?

    But to clarify from your last reply: "Simply put your "LevelSelectTutOver" function into the "Alternate Event" Section. When the tutorial was already done, this Event will be executed instead of the tutorial."

    Does that mean I should write a couple of lines of code and attach it to a GameObject and then drop that into Tutorial Designer? Or does the easier way you mentioned let me skip writing any code and drag and drop something that's already supposed to be in my scene? Sorry for any confusion on my part, but I need you to walk me through this one more time step-by-step from this point.
    http://i63.tinypic.com/zjbafd.png



  • Hi Milan,

    well, the "TutorialFinished" Scene in the DemoGame folder is set up and working correctly. If you by accident changed it or deleted something, you can download it again from the asset store. I would recommend you to watch the One-Time-Tutorial in this scene. Your screenshot is too small, I cannot recognize anything there.

    "TDesigner.[TutorialName].Global" is automatically written by TutorialDesigner. You don't have to change something there. Just use the write-function I mentioned in my previous post, and everything will be fine.

    As far as your 2. question is concerned, the Stepnodes or AlternateEvent uses the built in UnityEvents. You drop an object there, where a script is attached. Same as you would use Buttons in the UI system. Nothing special there.



  • Hey Michael,

    Okay, thanks. That makes sense. I was expecting to see the event show up in Player Prefs like it did the first time under the 'one-time tutorial' checkbox. But I tried it on my phone and it seems to be working with no issues. Thanks for all your help and patience.

    Best,
    Milan



  • No problem, glad to help.

    Best, Michael


Log in to reply