- Home /
Question by
wizardsambolton · Nov 17, 2014 at 02:31 PM ·
scene-loadingscenes
click change scene help!
hi! I am trying to make it when people click on the game object it switches scene but with my current code it switches scene wherever i click
here is my code:
using UnityEngine; using System.Collections;
public class Newlvl : MonoBehaviour { void Update() { if (Input.GetMouseButtonDown(0)) Application.LoadLevel("lvl2");
}
}
Comment
Answer by Wisearn · Nov 17, 2014 at 02:39 PM
Try: http://docs.unity3d.com/ScriptReference/MonoBehaviour.OnMouseDown.html
And make sure to have the script on the gameObject you want to click.
Your answer
Follow this Question
Related Questions
scene loading 100's of scenes 3 Answers
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Multiple scenes 2 Answers
traps player for a few seconds 1 Answer
How to add a cooldown to a move. 1 Answer