Failed to call function OnMouseEnter + OnMouseExit.

using UnityEngine;
using UnityEngine.EventSystems;
using DG.Tweening;

public class Hotspot : MonoBehaviour
{

    public GameObject ThisPanorama;
    public GameObject TargetPanorama;

    // Update is called once per frame
    void Update()
    {
        transform.Rotate(0, 0.5f, 0);
    }

    public void OnMouseDown(PointerEventData eventData)
    {
        OnMouseDown(eventData);
        OnHotspotTransition();
    }

    public void OnMouseEnter(PointerEventData eventData)
    {
        transform.DOScale(new Vector3(0.08f, 0.08f, 0.08f), 0.3f);
    }

    public void OnMouseExit(PointerEventData eventData)
    {
        transform.DOScale(new Vector3(0.05f, 0.05f, 0.05f), 0.3f);
    }

    public void OnHotspotTransition()
    {
        SetSkyBox();
    }

    private void SetSkyBox()
    {
        if (TourManager.SetCameraPosition != null)
            TourManager.SetCameraPosition(TargetPanorama.transform.position, ThisPanorama.transform.position);
        TargetPanorama.gameObject.SetActive(true);
        ThisPanorama.gameObject.SetActive(false);
    }
}

Anyone know why this isn’t working for me? Just trying to get a sphere to scale up as you mouse over it then scale back down after the mouse leaves.

Never mind I worked it out, removed the classes from OnMouseEnter and OnMouseExit and it worked! :slight_smile:

On another note when I click the hotspot in the scene it throws a stack overflow exception, but i can’t understand where its looping. Would anyone offer some insight here?

Once again I only find the solution after I post the problem >.< Removed onMouseDown from the class so it knows to run the hotspot transition after clicked