Ive been trying to make a game where when a green cube names “Goal” is touched by the player, it loads the next scene. I have all of the scenes in order with the same goal in all of them and im using this script:
#pragma strict
function OnCollisionEnter (col : Collision)
{
if(col.gameObject.name == "Goal")
{
var i = Application.loadedLevel;
Application.LoadLevel(i+1);
}
}
But when i touch the cube it does nothing…
Am I doing something wrong?
The script is in Javascript