Can you guys help me solve the problem with this script?
this is my script and i keep on getting this same error: Assets/complete scripts/DieOnHit.js(4,48): BCE0005: Unknown identifier: 'enemy'.
pragma strict
function OnTriggerEnter () { var enemy = transform.GetComponentInParent(enemy); enemy.Die(); }
Comment
Answer by d3st1ny33 · Dec 08, 2015 at 11:35 PM
read what kind of parameters are in getcomponent. unless enemy is a string elsewhere in your code.. but since its unknown identifier.. its telling you whats wrong
Your answer
![](https://koobas.hobune.stream/wayback/20220612051856im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Unity 5 - How to duplicate enemies whilst making them unique? 1 Answer
How do I i fix error CS0619? 0 Answers
ASSEST TRANSLATING IN VR 0 Answers
Unity 2d Animation 1 Answer
Trying to program two buttons to appear when the player in my game dies 0 Answers