Android build error. Health is not apart of UnityEngine.Component.
I am creating an FPS game for android using unity 5. The scripts were all working fine until I switched the build settings from PC to Android. Now I am getting multiple errors in multiple scripts. The one I am trying to fix first is one that says 'health' is not a member of 'UnityEngine.Component' on line two below. Can anyone help?
if(hit.transform.gameObject.tag == "Enemy"){ hit.transform.GetComponent("AiHealth").health -= Damage; }
I suggest that you add some substance to your post. Although I fully understand the problem, its generally unacceptable to not explain your problem in your post description - its also generally unacceptable to post more code than you need to (which is what you've done here).
Answer by mwjjr76 · Dec 01, 2016 at 04:01 AM
Problem solved by just removing the quotation marks.
Your answer
![](https://koobas.hobune.stream/wayback/20220612101716im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Playerprefs not saving on Android but saving in unity run editor 2 Answers
Android, fps drops after return to game 0 Answers
lag in android device but fps is good 0 Answers
How do I make headshots do more damage using raycast? 1 Answer
Help with bullet going in the dirrection fired from view of camera?? 1 Answer