This has most probably been asked heaps of times, but I’m not quite sure what to search… A link to a thread would do just as fine as an answer.
So I have an iOS sorta game in development where you can tap to jump, but also can click on buttons to like pause, for example. When I click a button, it also jumps - and limiting the area which can be clicked on to jump isn’t an ideal solution - so is there some way to check if a button was pressed on the tap - otherwise jump?
EDIT - Right now, jump is done by this:
void Update ()
{
if ((Input.GetMouseButtonDown(0) || Input.GetKeyDown("space")) && grounded)
{
GetComponent<Rigidbody>().AddForce(new Vector3(0f, 250f, 0f));
grounded = false;
}
}
void OnCollisionStay (Collision other)
{
if (other.gameObject.tag == "Block")
{
grounded = true;
}
}
void OnCollisionExit (Collision other)
{
if (other.gameObject.tag == "Block")
{
grounded = false;
}
}
(May have missed some syntax while I copied it)