Hi, so I am trying to get a fake click from just hovering over a button. The idea is to have a cursor without real buttons, but when the player puts the pointer over a UI element, after a second it clicks it.
I don’t know where to start, so any help would be very appreciated.
Thank you!
So you need that 1 second after the OnMouseOver is triggered it clicks the button?
[SerializeField]
private Button theButton;
private bool over = false;
void OnMouseOver()
{
over = true;
StartCoroutine( _Click() );
}
void OnMouseExit()
{
over = false;
}
IEnumerator _Click()
{
yield return new WaitForSeconds( 1f );
if ( over )
theButton.onClick.Invoke();
}