Forum rules - please read before posting.

How to associate different hotspot menus

Hi everyone,
AC 1.70.0 + Unity 2019.2.17f1 on a 2d game.

I have this situation: I have some empty hotspots. Or better, I have a named hotspot, and, in Label (if not name) I put a "space". So in this way I have the name of the hotspots, but, in game, my hotspots are empty.
My issue is if I use Background texture in Hotspot menu (original AC menu). In this case, it works perfectly if the hotspots are not empty, but if they are empty (or better with the "space") I see s little piece of background texture where it has to be empty.

These hotspots are grouped under a specific tag.

Is it possible to have two hotspots menu, one for all "traditional" hotspots and one specific for those in this tag to have a different behaviour with background texture?
Or if there'a some other solution.

Thank you very much.

Comments

  • I'm not clear on what it is you're trying to do. Are you just looking to disable the Hotspot menu for showing when over certain Hotspots?

    If so, you can hook into the OnHotspotSelect event to lock the Hotspot menu when selecting Hotspots with a given tag:

    using UnityEngine;
    using System.Collections;
    using AC;
    
    public class LockHotspotMenu : MonoBehaviour
    {
    
        public string lockTag = "myTag";
    
        void OnEnable ()
        {
            EventManager.OnHotspotSelect += OnHotspotSelect;
            EventManager.OnHotspotDeselect += OnHotspotDeselect;
        }
    
        void OnDisable ()
        {
            EventManager.OnHotspotSelect -= OnHotspotSelect;
            EventManager.OnHotspotDeselect -= OnHotspotDeselect;
        }
    
        void OnHotspotSelect (Hotspot hotspot)
        {
            StopAllCoroutines ();
            PlayerMenus.GetMenuWithName ("Hotspot").isLocked = (hotspot.tag == lockTag);
        }
    
        void OnHotspotDeselect (Hotspot hotspot)
        {
            StartCoroutine (Unlock ());
        }
    
        IEnumerator Unlock ()
        {
            yield return new WaitForEndOfFrame ();
            PlayerMenus.GetMenuWithName ("Hotspot").isLocked = false;
        }
    
    }
    
  • Hello Chris, sorry, I can't explain very well.
    Here my issue (when I use background texture on Hotspot Menu) on hotspot "empty" (I put a "space" in Label (if not name), so the empty has no name):
    https://drive.google.com/file/d/15JqokqPwT8lAiTIB8xB9EpMFlzWzN868/view?usp=sharing

    And here why there's that black row: https://drive.google.com/file/d/10HX-h23H8FzxHJBOBmmb6Zooo2f2zMr0/view?usp=sharing

    But if I don't add the space in Label (if not name), I see the name of the hotspot. The issue is when I use Background texture that seems to recognize the empty space and put the texture behind it.

    Is it possible to solve it? I thought to a second hotspot menu (without Background Texture) to link to the hotspots with a specific Tag.

  • You're telling me your intended solution, but not the original problem.

    What is the original issue you're trying to solve?

    The script above will lock the menu when over Hotspots with a certain tag, but could be amended to also unlock a second Hotspot menu at the same time.

  • I know the problem: https://drive.google.com/file/d/15JqokqPwT8lAiTIB8xB9EpMFlzWzN868/view?usp=sharing and the cause of the problem: https://drive.google.com/file/d/10HX-h23H8FzxHJBOBmmb6Zooo2f2zMr0/view?usp=sharing

    Maybe I can't undertand how your script works: does it block only the Hotspot menu (pratically only the words over the hotspots with a particular tag?

    If so, you can hook into the OnHotspotSelect event to lock the Hotspot menu when selecting Hotspots with a given tag:

    I can't undestand where I have to use the script: attached to a game object? on in other situations?

  • I'm talking about the situation itself. So far I can only guess that you want to prevent the Hotspot label from showing over particular Hotspots.

    The script above will do that, based on tag. Attach the script to a GameObject in your scene, and type in the name of the tag into its Inspector. When Hotspots with this tag are selected, the Hotspot menu (named "Hotspot" in the script) will be locked.

  • Fantastic, it 's perfect, thank you very much.

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.