Forum rules - please read before posting.

On-screen tutorial

edited June 2020 in Technical Q&A

dear fellas!
I just wonder if there is any specific method to implement an on-screen tutorial in the first scene of my game? for example, show the user where to touch to activate hotspots and how to touch to activate the Inventory menu? or to drag inventory items on hotspots? and of course, all should be during gameplay so that the whole game follows remains intact.

Comments

  • The physics demo has a tutorial, I think it uses a menu (or many, can't remember).
    You should download the demo and see if that approach works for you.

  • tnx. any advice or recommendations?

  • Using a Menu to display the tutorial text is the way to go.

    So far as how that text is stored goes, there's a couple of ways to go:

    1. Put the text itself inside a Global Variable (either of type String or PopUp), and have that variable's value be displayed inside a Label element.

    To change what tutorial is shown on-screen, you can then use the Variable: Set Action to update the variable's value - and, in turn, the menu.

    You'd then turn on the Menu, and update it as the player completes the different instructions given.

    1. Use the Objectives system to give the Player instructions. Objectives can be defined in the Inventory Manager. A single Objective can have multiple states - so a tutorial could be just one Objective, with each of the steps a different state.

    The state of an Objective can be updated with the Objective: Set state Action - and it can be selected after. The selected Objective can also be displayed in a Menu's Label element. This technique is indeed used by the Physics demo.

    If you import the package (best in a separate project for easier reference), see how all the tutorial states are defined in the Inventory Manager's Objectives tab, and how they are updated in-game with e.g. the "After intro" Cutscene.

  • edited June 2020

    tnx, I'll check that. What about showing the user where to click or touch? Is there any way to accomplish that type of on-screen tutorials?

  • How to you mean, exactly? It depends on the context.

    If you want the player to click on a specific Hotspot, you'd use that Hotspot's Interaction to update the tutorial with the next step.

  • I use double step hotspot interaction. Player should touch the hotspot. Then another menu apears on top of the screen which consist of interaction keys such as look, talk and use.after that user clicks on any interaction he/she likes. I should know if any hotspot clicked before user interacts with hotspot to anable the next guid on the screen.
  • This is for a specific Hotspot?

    Create a separate Cutscene that handles the updating of the tutorial text, and then have it so that choosing any of the Hotspot's Interactions runs it.

    This can either be done by using an ActionList: Run Action to trigger the Cutscene as part of the Hotspot's Interactions, or hook into the OnHotspotInteract custom event to trigger it through code automatically when any Hotspot interaction is run:

    using UnityEngine;
    using AC;
    
    public class ActionListOnInteract : MonoBehaviour
    {
    
        public ActionList actionListOnInteract;
        private bool runOnce;
    
        private void OnEnable () { EventManager.OnHotspotInteract += OnHotspotInteract; }
    
        private void OnDisable () { EventManager.OnHotspotInteract -= OnHotspotInteract; }
    
        private void OnHotspotInteract (Hotspot hotspot, AC.Button button)
        {
            if (runOnce) return;
            if (hotspot == GetComponent <Hotspot>())
            {
                runOnce = true;
                actionListOnInteract.Interact ();
            }
        }
    
    }
    

    This method also allows you to easily make sure it's only run once and not again with repeated interactions.

  • edited June 2020

    tnx, Chris. I manage to implement what I needed through listening to the event manager. like so:

    using UnityEngine;
    using AC;
    
    public class HotspotTutorial : MonoBehaviour
    {
    
    
    public string _MenuTitle;
    public ActionList _ShowHandOnHotspot;
    public ActionList _HideHandOnHotspot;
    public ActionList _ShowHandOnInteraction;
    public ActionList _HideHandOnInteraction;
    
    public void _StartTutorial()
    {
    
    
        EventManager.OnMenuTurnOn += menuIsOn;
        EventManager.OnMenuTurnOff += menuIsOff;
        _ShowHandOnHotspot.RunFromIndex(0);
    }
    public void _EndTutorial()
    {
    
    
        EventManager.OnMenuTurnOn -= menuIsOn;
        EventManager.OnMenuTurnOff -= menuIsOff;
        _HideHandOnInteraction.RunFromIndex(0);
        _HideHandOnHotspot.RunFromIndex(0);
    }
    
    
    private void menuIsOn(Menu iMenu, bool isInstant)
    {
    
            if (iMenu.title.Equals(_MenuTitle))
            {
                _ShowHandOnInteraction.RunFromIndex(0);
                _HideHandOnHotspot.RunFromIndex(0);
    
            }
    
    }
    
    private void menuIsOff(Menu iMenu, bool isInstant)
    {
        if (iMenu.title.Equals(_MenuTitle))
        {
            _HideHandOnInteraction.RunFromIndex(0);
            _ShowHandOnHotspot.RunFromIndex(0);
    
        }
    }
    }
    

    then I manually create interaction for showing hand on a hotspot in the first place and a procedure to finish the tutorial and run it from the action list by calling Object:Call Event to finish it. It may not a robust job but, it works! >:) >:)

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.