Forum rules - please read before posting.

No label over a hotspot

I have a simple question.

How to hide label over a hotspot?

Comments

  • You can lock the Hotspot menu using Menu: Change state Action, or (if there is no background to your Hotspot menu) set the Hotspot's label to a single space.
  • @ChrisIceBox I have a colored block (inserted an Image component on the Rect Transform that holds my Text element) behind my hotspot labels. If I type a single space in the hotspot name, a small block still shows up.

    Is there any way to completely disable the hotspot label from showing on a given hotspot? If not, it would definitely be nice to add that feature in a future version :smile:
  • @iamlowlikeyou Such a feature is now possible by hooking into custom events:


    Paste that into a C# script named DisableHotspotLabel, and attach to any Hotspot you want to hide the Menu for.
  • @ChrisIceBox Very nice, thank you!
  • Hi Chris,

    I would make use of that script, but it's not available anymore. Could you reupload it, please?

    Thank you!

  • using UnityEngine;
    using AC;
    
    public class DisableHotspotLabel : MonoBehaviour
    {
    
        private Hotspot ownHotspot;
        private Menu hotspotMenu;
    
        private void Start ()
        {
            ownHotspot = GetComponent <Hotspot>();
            hotspotMenu = PlayerMenus.GetMenuWithName ("Hotspot");
        }
    
        private void OnEnable ()
        {
            EventManager.OnHotspotSelect += OnHotspotSelect;
            EventManager.OnHotspotDeselect += OnHotspotDeselect;
        }
    
        private void OnDisable ()
        {
            EventManager.OnHotspotSelect -= OnHotspotSelect;
            EventManager.OnHotspotDeselect -= OnHotspotDeselect;
        }
    
        private void OnHotspotSelect (Hotspot hotspot)
        {
            if (hotspot == ownHotspot)
            {
                hotspotMenu.isLocked = true;
            }
        }
    
        private void OnHotspotDeselect (Hotspot hotspot)
        {
            if (hotspot == ownHotspot)
            {
                hotspotMenu.isLocked = false;
            }
        }
    
    }
    
  • Works beautifully. Thank you!

  • HI, I'm trying to use the above script but have encountered a problem. I'm using it on doors. If I click a door and the scene changes without the mouse leaving the hotspot then the menu never turns back on and is missing in the new scene. Is there an easy way to fix this? Thanks!

  • You'd need to unlock the Menu after the scene change.

    You can either add another hotspotMenu.isLocked = false; statement to the OnDisable function, or use the Events Editor to use the Menu: Change state Action to unlock the Menu as part of the Scene: Change: After event.

  • Fabulous! Thank you Chris! Option #1 did the job :)

  • Another slight issue with the script. At one point I have a hotspot without this script (hotspot A) overlapping a hotspot with this script (hotspot B). If I hover the cursor from hotspot A to hotspot B the label for hotspot A remains visible.

  • I can't recreate such behaviour.

    What are your AC/Unity versions, and is this for a 2D game? If so, check that Hotspot A is closer to the camera than Hotpsot B.

  • Unity 2020.3.22f1 / AC 1.75.8 Hotspot A is definitely closer to the camera...

  • It's an old AC release. Try testing this in the latest, in a duplicate of your project.

  • Updating to 1.97.3 didn't solve the problem

  • I don't have enough to go on. Is this for a 2D game?

    If you'd like to PM me your Managers, the script, and an example scene, as a .unitypackage file, I will take a look.

  • I seem to have fixed it by adding hotspotMenu.TurnOff(); to the OnHotspotSelect function. But I have no idea wtf I'm doing, so I'm afraid everything might explode now... Does that seem like an acceptable solution to you?

  • It can't hurt - as the Hotspot menu's Appear type is set to On Hotspot, it will turn itself back on when necessary. You should be fine.

  • Thanks!

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.