When an Enemy dies it triggers an event in the Game State which uses “Get All Actors of Class” and sets a variable. The trouble is it’s not clearing the Enemy calling this event, the workaround I have at the moment is a slight delay but I wonder if there is a better method?
Hey @espr3ss0!
One thing you could do is put an input on the event so you could pass “Self” into the call from the Enemy blueprint, then as part of the Game State’s event, you can “Find” and “Remove” the Enemy from the “Get All Actors Of Class” array!
Hope that helps!
Thanks but not wanting to store the array.
If you’re just wanting the LENGTH, you can do an “IsValid?” to see if the enemy has been destroyed yet, directly after the get all actors node. Then if True, -1 to that length, and if False, do not subtract. Or failing that, check if that gets put into the array and then -1 if it is indeed there. You don’t have to store the array, but it will stick around for a second to act upon it.