I'm using hotspots with the add on script for triggering Mouse Over / Mouse Exit AC action scripts. This normally works perfect, but I need to stop Mouse Over events when the hotspot is behind a collison mesh or cube.... any ideas, as in this case, I can't use Interactive Boundarys.
The code I have is...
using UnityEngine;
using AC;
public class MouseOverMouseExit : MonoBehaviour
{
public ActionList actionListOnEnter;
public ActionList actionListOnExit;
private void OnEnable ()
{
EventManager.OnHotspotSelect += MySelect;
EventManager.OnHotspotDeselect += MyDeselect;
}
private void OnDisable ()
{
EventManager.OnHotspotSelect -= MySelect;
EventManager.OnHotspotDeselect -= MyDeselect;
}
private void MySelect (Hotspot hotspot)
{
if (GetComponent <Hotspot>() == hotspot)
{
actionListOnEnter.Interact ();
}
}
private void MyDeselect (Hotspot hotspot)
{
if (GetComponent <Hotspot>() == hotspot)
{
actionListOnExit.Interact ();
}
}
}
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
What is your Hotspot detection method, and is this for a 2D or a 3D game?
If Mouse Over, then Hotspots will not be selectable if there is a Collider on the Default layer between them and the MainCamera.
Fantastic, thank you - I never thought to check my Collider had been changed from the Default layer - now its back on that, all is working as expected.