I am trying to accomplish a hover state for when a mouse enters and exits the GameObject.
Only when the OnMouseExit is //commented out the function OnMouseOver() decides to work but the OnMouseExit will not. Both function will not work together.
…when the OnMouseOver() works the hover will not deactivate again. Which is why i am trying to use OnMouseExit()
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor.UI;
public class NewBehaviourScript : MonoBehaviour
{
public GameObject selected;
public GameObject hover;
// Start is called before the first frame update
void Update()
{
if (Input.GetMouseButtonDown(0))
{
selected.SetActive(true);
hover.SetActive(true);
}
}
void OnMouseOver()
{
hover.SetActive(true);
}
// public void OnMouseExit()
// {
// hover.SetActive(false);
// }
}