Hey,
I have a question about OnMouseDown,
Right now I have an if statement on in that says that if the mouse is down then do this.
Else
aplication.loadlevel etc
Right now it only loads the other scene if I click anywhere except the object the script is attached to.
I want that to happen, but I want it to also load that scene if there is no mouse click at all.
Thanks
Ok so what you need is an update function within your Mouth class like this:
// declared at the top with your other class variables
float timeOut = 5.0f; // 5 seconds
private float timer = 0.0f;
// Then the update function
Void Update()
{
timer += Time.deltaTime;
if (Input.GetAxis("Mouse X") || Input.GetAxis("Mouse Y"))
{
// the player moved the mouse, reset the timer
timer = 0.0f;
}
if (timer > timeOut)
{
// inactivity for a period has occured, do what you want
}
}
This obviously only checks for mouse movement, but you can easily change the checks to check for a mouse key press