I have created a small script that tests for whether the mouse is over a UI element, and returns that state. I then use this to determine whether to raycast.
It works properly on the Mac, but when testing on the iPad, it doesn't.
Any idea what I might be doing wrong?
using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;
public class touchTest : MonoBehaviour {
public int overUI = 0;
public int ReturnUIState (){
return overUI;
}
void Update () {
if (EventSystemManager.currentSystem.IsPointerOverEventSystemObject ()) {
// we're over a UI element...
overUI = 1;
}
else{
overUI = 0;
}
}
}
Thank you!
↧