- Home /
I can't get a collision to cause the end of my game
I need help getting a collision to cause the end of my game. I have got a java script, which will be put below, and I have given the 'wall' a box collider, and rigidbody. I have set it up where the character has a capsule collider and is the trigger, and the 'wall' uses the script, and it's rigidbody is kinematic. I have tried this the other way but it still didn't work. The script I'm using. I'm knew to scripting, so sorry if it's terrible:
function OnTriggerEnter () { Application.LoadLevel ("scene it will load"); }
Any help will be apreciated. Thanks
Answer by AlucardJay · Nov 11, 2012 at 05:25 AM
try this :
function OnTriggerEnter( other : Collider )
{
Debug.Log( " Triggered by " + other.gameObject.name );
Application.LoadLevel ("scene it will load");
}
Then check the console to see what affected the trigger =]
http://docs.unity3d.com/Documentation/ScriptReference/Collider.OnTriggerEnter.html
Your answer
![](https://koobas.hobune.stream/wayback/20220613083653im_/https://answers.unity.com/themes/thub/images/avi.jpg)