+ 1
I made a script in Unity to any object(enemy) such that when I click it it's health decreases,I found the tutorial on YouTube and it works for him. I re-checked the code and I even typed the whole code again but still doesn't work It just shows health = 100
Game development
8 odpowiedzi
+ 7
Unless we see the code, we can't really help...
+ 7
Try using health instead of Health in the function because variable names are case-sensitive
+ 7
Make sure player health and enemy health aren't the same variable. Try playerHealth and enemyHealth
+ 7
BTW it's JavaScript, not Java 😀
+ 5
make sure the box collider on both objects are in the right places
+ 1
Ok I'll type.....wait a bit
0
It's actually Java I think
#pragma strict
var health = 100;
function ApplyDamage (TheDamage:isn't)
{
Health-=TheDamage;
}
0
No I typed in health,in both player and enemy,it's just a typo in my iPad