(I know there are many threads about this, but none seem to fix my issue)
I’ve been trying to get a UI Button component to make another text component change when highlighted.
Even though I have a 2D Rigidbody and I made sure to make it a trigger, I can’t get my code to enter the OnMouseOver() event. I don’t have a background and my Button is set to “Raycast Target”.
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class mouseOverController : MonoBehaviour
{
public Text descriptionText;
public string description;
void Start()
{
descriptionText = descriptionText.GetComponent<Text>();
}
public void OnMouseOver()
{
Debug.Log("Here"); //This is never logging
descriptionText.text = description;
}
}
This script is attached to each Button that I want to change my text component.
Any ideas? All suggestions you can come up with are welcome!