Forum rules - please read before posting.

NavMesh with Label under cursor

Hi, i want to create walkable area, but i want to show label under cursor (something like Hotspot on navmesh). Is there any way to do that. Something like when move cursor to walkable sidewalks it shows "Sidewalks with gums" or when move cursor to sand road it shows "Dusty road".

Thank you

Comments

  • Welcome to the community, @roh032.

    It's a bit tricky, but it is possible. Is this for a 2D or a 3D game, and are you using Point And Click movment?

    The Hotspot label requires a Hotspot, so you'd have to place down a Hotspot that covers the same area as the NavMesh. To have it so that clicking it causes the character to move to it, you can use this simple script (MoveToHotspot.cs):

    using UnityEngine;
    using AC;
    
    public class MoveToHotspot : MonoBehaviour
    {
    
        private void OnEnable () { EventManager.OnHotspotInteract += OnHotspotInteract; }
        private void OnDisable () { EventManager.OnHotspotInteract -= OnHotspotInteract; }
    
        private void OnHotspotInteract (Hotspot hotspot, AC.Button button)
        {
            if (hotspot.gameObject == gameObject)
            {
                Vector2 mousePosition = KickStarter.playerInput.GetMousePosition ();
                hotspot.walkToMarker.transform.position = KickStarter.playerMovement.ClickPoint (mousePosition);
            }
        }
    
    }
    

    Attach this to the Hotspot, and then define a "Use" interaction for the Hotspot (but don't supply an Interaction ActionList). If it shows in the Hotspot's Inspector, check Single 'Use' Interaction?.

    This script works by hooking into the OnHotspotInteract custom event, fired when the Hotspot is clicked on, and then moving the Player to the cursor's position. A tutorial on their usage can be found here.

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.