Hey! I need help with Onmouseover script
How could I make Onmouseover like reversed (Like !Onmouseover or Onmouseover = false) kinda thing?
using UnityEngine;
using UnityEngine.EventSystems;
using System.Collections;
public class ExampleClass : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{
private bool hovered = false;
public void OnPointerEnter(PointerEventData pointerEventData)
{
hovered = true;
}
public void OnPointerExit(PointerEventData pointerEventData)
{
hovered = false;
}
void Update()
{
if(!hovered)
{
Debug.Log("Not hovered");
}
}
}
This script must be attached on the object with the collider.
Don’t forget to have a PhysicsRaycaster
on the camera and an Event System
with an InputModule
in your scene.