Using Oncollisionenter with js, the script does not work:
#pragma strict
function Start () {
}
function Update () {
}
function OnCollisionEnter (collision : Collision) {
if (collision.gameObject.name=="Player")
{
Application.LoadLevel("Level2");
Debug.Log("YAy");
}
}
Also, The YAy does not appear in the log.
The name is correct
The script is attached to the wall to which the player(FirstPersonController) must touch.
The wall has a box collider
PS: If anyone has an alternative, please post it, it would be greatly appreciated, c# is my preferred language.