Killing Player doesn't work
I know how to script properly in Javascript, but now i am getting a little crazy here... For some reason my functions aren't working as expected in ANY script. I don' t know if i am too stressed that i am missing the basic things, but i am really annoyed by this.
I have actually 3 scripts that are ignoring it's funcions because they want. I am serious, everything is fine and still they are just ignoring their codes and i can't do anything -.-
But this one got me. I want to kill my player, and i am almost sure that i've set everything fine, but my player just doesn't die!
#pragma strict
function OnCollisionEnter(collision: Collision) {
if (collision.gameObject.tag == "Aim")
{
}
if (collision.gameObject.tag == "Player")
{
Debug.Log ("I warned you!");
Destroy(collision.gameObject);
}
}
function OnCollisionExit(collision: Collision) {
}
What am i doing wrong? The player has a collider, the cube that is supposed to kill him (I named it DeathWish because it will ONLY kill the player if he tries to explore a glitch) has a collider too, both of them have rigidbody. But still, my character walks around the cube without dying and my log isn't being displayed too i don't know why. Oh, and my character is tagged properly.
Your answer

Follow this Question
Related Questions
Audio Endless Loop c# 1 Answer
How to enable a script in Play-Mode? 1 Answer
How do I make a Bounce/trampoline script? 0 Answers
ScriptingProblems - Open door with 3 keys 1 Answer
Game development general question(Multiplayer - Singleplayer) 1 Answer