Forum rules - please read before posting.

Hint system inside objectives

I'm trying to create a objective sub menu for a single objective that would also show hints connected to that objective. It would work so that there are buttons with a + sign. There is a timer that gives player to have one hint to be shown after some period. And when player has the hint permission, he can press one of the +s and then that + would be replaced with a hint.

Here's a pic:
https://imgur.com/a/fuWbDQ3

I was first trying to have a button which covers the hint text, but it seems that the Remember visibility doesn't like UI buttons. Any ideas how to approach this thing?

Comments

  • Remember Visibility won't work, but if you map the + button to a Button element in the Menu Manager, it's visibilty will be saved automatically when using the Menu: Change state Action to hide it.

    Alternatively, you could attach a Canvas Group component and make use of a custom Remember script to record its alpha / interactable values:

    using UnityEngine;
    
    namespace AC
    {
    
        [RequireComponent (typeof (CanvasGroup))]
        public class RememberCanvasGroup : Remember
        {
    
            public override string SaveData ()
            {
                CanvasGroupData data = new CanvasGroupData();
                data.objectID = constantID;
                data.savePrevented = savePrevented;
    
                CanvasGroup canvasGroup = GetComponent<CanvasGroup> ();
                data.alpha = canvasGroup.alpha;
                data.isInteractable = canvasGroup.interactable;
    
                return Serializer.SaveScriptData <CanvasGroupData> (data);
            }
    
            public override void LoadData (string stringData)
            {
                CanvasGroupData data = Serializer.LoadScriptData <CanvasGroupData> (stringData);
                if (data == null) return;
                SavePrevented = data.savePrevented; if (savePrevented) return;
    
                CanvasGroup canvasGroup = GetComponent<CanvasGroup> ();
                canvasGroup.alpha = data.alpha;
                canvasGroup.interactable = data.isInteractable;
            }
    
        }
    
        [System.Serializable]
        public class CanvasGroupData : RememberData
        {
    
            public float alpha;
            public bool isInteractable;
    
            public CanvasGroupData () { }
    
        }
    
    }
    
  • I had another idea like this:
    https://imgur.com/a/Qs3QR91

    The plus button would be only visible if there are hints to be shown and hint timer has given another available hint. The hint labels would be visible if they are given via the plus button.

    The idea is that I would use the Started state descriptions as hints and I would have a 0- or 1- in front of the actual hint and hints are separated by commas - like this:
    1-Is there a pen somewhere here?;0-I think I saw pens somewhere.
    Here the first hint is shown.

    This way I could check which hints are already got. But then I realized that the descriptions are translated.

    I was wondering if you would have another idea how to manage this.

  • A variable as a hint state storage?

  • I'd suggest working it out for just a single Objective first, and only then looking into how you might expand it for others.

    The simplest way to have a "+" turn into hint text is to have a Button element - which shows the "+" - run the Menu: Update content Action when clicked to alter the text. If you wanted to prevent this with certain logic (i.e. not run if a particular variable is the wrong value), you can just precede this Action with a Variable: Check.

  • I'm having trouble to get this menu to work.
    Here's pics:
    https://imgur.com/a/3qaPONl

    For some reason the ActionList is not run when the objective button is clicked.

  • The up and down buttons work fine.

  • How are you determining this? What Actions are being run?

    Are the Objective labels appearing correctly?

    Avoid using "Unity UI In Scene" when possible - switch it to "Unity UI Prefab" if possible and spawn it in at runtime.

  • It was silly. I turned the Images off, and so also the ray tracing.

  • But I think a hint system within the objectives would be a great addition. My own idea would be a list with boolean info of is the hint already visible for the player.

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.