- Home /
Awareness script doesnt work
function OnCollisionEnter (collision : Collision) { if(collision.gameObject.tag == "BulletSR") { Damaged = true; time = 100; maxhealth -= damage*10; } if(collision.gameObject.tag == "BulletSMG") { Damaged = true; time = 100; maxhealth -= damage; } if(maxhealth <= 0) Destroy(gameObject, 0.000001); }
//it gives no errors, but it never becomes true
same thing with this one, this one is more important
var Aware : boolean = false;
function OnCollisionEnter (collision : Collision) { if(collision.gameObject.tag == "Player") { Aware = true; } }
For the second script, did you tag the game object that is collided or the game object that collides (the one that attaches this script) as "Player" ?
Your answer
Follow this Question
Related Questions
FPS gun clippes through walls 5 Answers
Can I apply locomotion system to fps? 2 Answers
FPS: Make animated character weapon follow camera movement 1 Answer
How can i make a raycast in my fps game? 1 Answer
animations or code? 1 Answer