using UnityEngine;
using System.Collections;
public class BoxTrigger : MonoBehaviour {
void OnCollisonEnter(Collider obj)
{
if(obj.gameObject.name == "boxPrefab") {
Application.LoadLevel(2);
}
if(Application.levelCount == 2)
{
Application.LoadLevel(3);
}
if(Application.levelCount == 3)
{
Application.LoadLevel(4);
}
if(Application.levelCount == 4)
{
Application.LoadLevel(5);
}
else {
Application.LoadLevel(6);
}
}
}
What it’s supposed to do: When the First Person Controller (Named “player” hits the prefab “boxPrefab” it moves on to the next level, if it’s already level 2, it goes on to level 3. and so on.
My issue: It builds right, with no errors. yet when I collide with the box, nothing happens?
the script should be in the Player. and I have the BoxCollider set as a trigger.