Forum rules - please read before posting.

Way to monitor if Hotspot is Enabled or not dynamically in Inspector?

I'm trying to find a rogue action node which is enabling a hotspot in my game before it should be. I'd like to monitor whilst running the game when that hotspot becomes Enabled so that I can hunt down where and at what point it is being triggered.

Thanks.

Comments

  • You can add a hook to the OnHotspotTurnOff custom event:

    using UnityEngine;
    using AC;
    
    public class HotspotEventTest : MonoBehaviour
    {
    
        private void OnEnable ()
        {
            EventManager.OnHotspotTurnOff += MyHotspotTurnOff;
        }
    
        private void OnDisable ()
        {
            EventManager.OnHotspotTurnOff -= MyHotspotTurnOff;
        }
    
        private void MyHotspotTurnOff (Hotspot hotspot)
        {
            Debug.Log ("Hotspot " + hotspot + " was turned off", hotspot);
        }
    
    }
    
  • I'm not a coder. Could you highlight the parts of that script I should replace with the name of the Hotspot in my scene I want to monitor?

  • Worked it out, thanks.

  • Replace the above with this, then assign the Hotspot in the Inspector field:

    using UnityEngine;
    using AC;
    
    public class HotspotEventTest : MonoBehaviour
    {
    
        public Hotspot hotspotToCheck;
    
        private void OnEnable ()
        {
            EventManager.OnHotspotTurnOff += MyHotspotTurnOff;
        }
    
        private void OnDisable ()
        {
            EventManager.OnHotspotTurnOff -= MyHotspotTurnOff;
        }
    
        private void MyHotspotTurnOff (Hotspot hotspot)
        {
            if (hotspot == hotspotToCheck) Debug.Log ("Hotspot " + hotspot + " was turned off", hotspot);
        }
    
    }
    
  • Thanks. tracked down my rogue hotspot!

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.