- Home /
 
 
               Question by 
               johntheunsto · May 07, 2014 at 05:19 AM · 
                javascriptcollisionphysicspccollisiondetection  
              
 
              Collision not working
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 ()
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by mike hwang · May 07, 2014 at 05:41 AM
MeshFilterEditor is not assign. Check this 1st.
Try to add Rigibody component. Disable isTrigger flag that for onTrigger() only. Maybe OnTrigger() is more suitable for you.
Your answer