Forum rules - please read before posting.

Add a highlight to hotspost

Is there a way to assign a highlight function to all hotspots in my game, or does it have to be done manually by adding a 'highlight' component and then linking it to each hotspot individually?

Comments

  • Welcome to the community, @SnarkHunters.

    Through scripting, yes: you can hook into the OnHotspotSelect / OnHotspotDeselect custom events to react to any Hotspot being selected and deselected.

    This can either be done through code:

    using UnityEngine;
    using AC;
    
    public class HotspotEventsExample : MonoBehaviour
    {
    
        private void OnEnable ()
        {
            EventManager.OnHotspotSelect += OnHotspotSelect;
            EventManager.OnHotspotDeselect += OnHotspotDeselect;
        }
    
        private void OnDisable ()
        {
            EventManager.OnHotspotSelect -= OnHotspotSelect;
            EventManager.OnHotspotDeselect -= OnHotspotDeselect;
        }
    
        private void OnHotspotSelect (Hotspot hotspot)
        {
            Debug.Log ("Hotspot " + hotspot + " was selected");
            // Hotspot 'hotspot' was selected
        }
    
        private void OnHotspotDeselect (Hotspot hotspot)
        {
            Debug.Log ("Hotspot " + hotspot + " was de-selected");
            // Hotspot 'hotspot' was de-selected
        }
    
    }
    

    Or with the Events Editor, available in the top toolbar. With the Editor, you can run an ActionList asset each time a Hotspot is selected/deselected, passing in that Hotspot as a GameObject parameter.

  • Thank you very much Chris, kind as usual!

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.