I have a empty game object named house. Inside which I have 3 cubes, one named ‘Trig’ and the other 2 just ‘cube’. I also have box colliders on all of them. I want it to load the next level when the player collides in the ‘Trig’ cube. But my game won’t. Here is my script:
#pragma strict
function OnCollisionEnter (col : Collision) {
if(col.gameObject.name == "Trig") {
Application.LoadLevel(2);
}
}
It also shows an error in the console : NullReferenceException: Object reference not set to an instance of an object
MeshFilterEditor.OnEnable ()