|
i made a script for a ship because i wanted to be able to destroy certain parts of it when they take enough damage, except the health variable doesn't go down. i can see the sparks from the bullets and they are hitting the ship and if i shoot a missile it will explode on the ship but it takes no damage. here's my script: anyone know the problem?
(comments are locked)
|
|
That script would work as-is, so there must be some other factor involved. However it's not very efficient to constantly check the health in Update, given that it only changes occasionally. Instead just check when you need to:
(comments are locked)
|

Put some Debug.Log in that OnCollisionEnter function, make sure that it is definitely getting called.
well i put Debug.Log in and it got called for the missiles 3 times out of 5 but not for bullets
this is my gun script