- Home /
Problem is not reproducible or outdated
I really need help with this.
Good day all, i have used alot of time by figuring this out. And it will simply not work. Hope someone in here can help :)
The problem: I want my enemy gameObject to loose Health when i click on it and when 0, then die. This is my script.

I can see that it registers the ColliderBox , but when i click it will not loose health.
Answer by Bunny83 · Sep 26, 2015 at 01:36 PM
First of all you seem to write your code in UnityScript. Are you sure this code is in a ".js" file?
Second, almost all programming languages are case sensitive. So casing matters. "update" is not the same as "Update". You should rename your method.
Another thing that isn't an actual error but you should be more consitent when naming your variables. There are different conventions. It doesn't really matter which you use as long as you stay consistent. "health" and "TakeDamage" is not consistent ^^. "takeDamage" would be better.
Answer by jnielsen · Sep 26, 2015 at 05:40 PM
I found the problem... It was an error in the word GameObject. It should have been GameObject not gameObject. Damn... :D
(First time coding for real, so i guess i'll learn by my mistakes :D.