Randomly select a scene

For example, I want it so when the player collides with an object, it then gets sent to a random scene. Here’s a code that I failed to make. Can anybody make a script for that reason?

var LevettoLoad : String;

function OnCollisionEnter (Collison : Collision) {

if(Collison.gameObject.tag == "Player")
{
 Application.LoadLevel (Random.Range(0, Application.levelCount-1000));
}   

}

First, don't ask others to do the work for you. Second, why the heck do you subtract 1000 from the level count? If you remove the -1000 it should work...

–

1 Answer

1

Search functions are really not that bad…