im trying to make a script that when you collide with a game obj you are transferred to a new scene… how do i write this?
You can detect collision by having
OnCollisionEnter(Collision c)
method in your MonoBehaviour. When you detect collision you can change scene with
Application.loadLevel("level name")
method
As suggested by @Lo0NuhtiK you need to check when your object collides. To do that, you do exactly what he said. You can also filter collision objects by tag or name:
function OnCollisionEnter(other : Collision){
if(other.gameObject.name == "SomeObject"){
Application.loadlevel("Level name");
}
if(other.gameObject.tag == "SomeTag"){
Application.loadlevel("Level name");
}
}