Hi everyone, I am really bad at scripting and I want to know what to do to make this simple script work.
function Update ()
{OnCollisionEnter=
Application.LoadLevel(1);
}
I want to make it so that when something collides with a particular object it will load the next level. I know it is a dumb question but any help would be awsome.
function OnCollisionEnter () {
Application.LoadLevel(1);
}
Remove the Update () and only do the above. If the object is set to trigger then use OnTriggerEnter instead. Remember that they are separate functions and they can’t run inside Update.
If you only want a specific object by tag trigger the level loading then add:
function OnCollisionEnter (collision : Collision) {
if (collision.collider.tag!="The Tag") return;
Application.LoadLevel(1);
}
If it is a trigger then use this instead:
function OnTriggerEnter (other: Collider) {
if (!other.CompareTag("The Tag")) return;
Application.LoadLevel(1);
}