Can anyone figure out why the below code won’t work? Its a simplified version of what I’m trying to achieve, but I can’t get it going:
function Update () {
var rect = Rect(0,0,Screen.width,Screen.height);
if(rect.Contains(Input.GetTouch(0).position)) {
linkToToggleFireL.onFire();
}
}
Essentially, what I’m telling it is this: if I touch the screen, shoot fire. But if I touch the screen, nothing happens. Ever. The onFire function is contained in another script and the same linkToToggleFireL.onFire(); works elsewhere in this script, just not with the rectangle. Any ideas what I’m doing wrong? Also if anyone knows how I could use fingerId in place of GetTouch(0) that would be wonderful.