- Home /
Tagged Load level
i was making a game,but the load level script i was using keeps hitting other stuff
i want to be like
if you are tagged player,the load level script works:if you aren't ,the load level script does not work
my script so far
pragma strict
function Start () {
}
function OnTriggerEnter () {
Application.LoadLevel("MyLevel");
}
Comment
Answer by JoaquinRD · Oct 12, 2013 at 03:47 PM
http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.OnTriggerEnter.html
var levelToLoad : String;
function OnTriggerEnter(other : Collider)
{
if (other.gameObject.tag == "Player")
{
Application.LoadLevel(levelToLoad);
}
}