So am new to unity and i messing around and i have added some basic combat. The way it works is using onTriggerEnter to detect when hit with a weapon and then subtract the health until it has 0 and the object us destroyed. I have a friendly ai that goes after the enemy, i have the ebemy so that goes after me, and then i have myself. I can kill the enemy, my friendly ai can kill me, but for some reason it can’t kill the enemy ai. It has all the required tags. Any idea what might be wrong?
I recommend liberally sprinkling Debug.Log() statements through your code to display information in realtime.
Doing this should help you answer these types of questions:
- is this code even running? which parts are running? how often does it run?
- what are the values of the variables involved? Are they initialized?
Knowing this information will help you reason about the behavior you are seeing.
How to report problems productively in the Unity3D forums:
No idea because I don’t know how your AI works.
Okay thanks. I already tried this but now that am thinking back to this i think i might know at least what i might need to look up to try and find a solution