When my tanks shoot a unit spawner and it runs out of health it doesn’t die and functions like a living unit spawner would. I tried copying and pasting code from the lecture resources but it didn’t seem to work.
Hi, I’m not exactly sure how it is setup at the stage of the course you are in. However, at some point the unit spawner should subscribe to the health ServerOnDie event.
The structure is that when the health gets let, this event is invoked, and then the unit spawner runs the death logic, in this case destroy the game object.
Note: you will need to have hold of the correct health object for this to work.
Let me know if that helps at all.
Thanks I fixed it. It was in that ServerHandleDie method, the line of code that destroyed the buildings was commented out for some reason.
1 Like
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.