Something is trying to remove the Health script from my enemies

I’m not sure when this started, but I’ve just noticed that when I stop running my game, I get there messages saying “Can’t remove Health (Script) because CombatTarget (Script) depends on it.”

That’s all the error says but if I double click on one of the errors it selects one of my enemies. How do I track down an error that only shows up when the game is stopped? It’s like, the act of stopping the game is trying to delete the script from my 3 enemies.

Thanks.

Look through your code for a line containing “Destroy(”, quite possibly Destroy(this) in your Health.cs script.

Nope. None of my scripts have Destroy in them anywhere. I also went through all the scripts for any time Health was used and nothing seems to indicate wanting to remove the script from anything. Though I did learn about Visual Code’s search feature that searches through all the scripts at once which was kind of cool…Until I discovered I had accidentally clicked Replace All instead of Dismiss on a couple scripts and had every mention of Health replaced by a space…Luckily I hadn’t actually closed any of them so was able to undo…That was close…

Quite the mystery… I’m not quite sure what’s going on, then. Somewhere, something is trying to Destroy() the Health component. Can you paste the complete call stack on that error? (Click on the error and you’ll get a verbose listing at the bottom of the console. It’s better to copy and paste than to take a screen shot of it.

I know you said to copy and paste, but, if you’re referring to the bit below the blue box, that’s all there is. Not much to copy and paste. Unless I have something set wrong and I’m not seeing what I should be.

In this case, it didn’t matter, since the error appears not to have a call stack. I’m honestly not sure what’s going on here.

1 Like

Well, it’s fine. I’m thinking I might have to rebuild all the characters anyway. I had to split out my player because I’d gone and applied all changes from an enemy to the character prefab which totally messed up my Player. I feel splitting it out is probably going to be a problem at some point.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms