Hi,
In my game you are able to switch between two scenes using the right click button of a mouse.
When the right click button is pressed (and is held down) this loads scene 1 using this script:
private var mouseDownStart:float;
function Update () {
if (Input.GetMouseButtonDown(1))
{
mouseDownStart = Time.time;
}
if (Input.GetMouseButton(1))
{
if ((Time.time - mouseDownStart) >= 3)
{
Application.LoadLevel(1);
}
}
}
And in scene 1, when the right click button is released, I want scene 0 to load. At the moment I’ve tried using this script, but nothing happens when the right click button is released.
private var mouseDownStart:float;
function Update () {
if (Input.GetMouseButtonUp(1))
{
mouseDownStart = Time.time;
}
if (Input.GetMouseButton(1))
{
if ((Time.time - mouseDownStart) >= 3)
{
Application.LoadLevel(1);
}
}
}
Does anyone know if there’s a way to load a scene when the right click button is released? (And if it is a problem that the button was initially pressed in a different scene?)
Best, Laurien
(I realise controlling the scene changes in this way sounds confusing - it’s part of an art installation so I’ve actually rewired the right click button of a mouse to a different control panel, so it will make more sense when playing it)