Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

Killing Player doesn't work

$
0
0
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.

Viewing all articles
Browse latest Browse all 1875

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>