So I’ve checked around and normally I’m able to find this stuff, or find a work around.
For reference-
I have 3 UI objects, one is a button called “Up Kills”, and its subsequent text “Upkilltext”
The other object is a text object named “Hahlol”.
Up Kills has an EventTrigger script attached to it.
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine;
using UnityEngine.EventSystems;
public class UpgradeKillButton : EventTrigger {
//Text UpInfo = GameObject.Find("Hahlol").GetComponent[UnityEngine.UI.Text](); ??????
public override void OnPointerEnter(PointerEventData data)
{
UpInfo.text = ("Lol JK it does nothing");
}
public override void OnPointerExit(PointerEventData data)
{
UpInfo.text = ("");
}
}
The commented line is the one I’m having trouble with.
Usually I just use a [SerializeField] and call it a day, (Just learning here, expecting to find a better way later.)
But that wont show up in the Inspector.
So what I’m attempting to do, is change the text of “Hahlol” whenever the mouse has entered the button, and upon leaving, remove the text.
Not looking for a copy-paste answer, if you can avoid it.
Thanks.