How to I check for length of an array append?

Hello, I am attempting to create a win-state when all of two different enemy types in the level are dead/gone. I have attached the code that I’ve tried to create.

I’m trying to check for the length of both of these enemy bp’s (array appended together), triggering a print text when the length is equal to 0. But I don’t know how to check for the length of both of the BP’s and not just one.

Any help is appreciated. Thank you!

Why not just create an array of type actor or even object => basically a base class to these two classes and add to that array in the final step just get it’s length.

Edit => Simplified sum function:


It would be better to have a dispatcher on each enemy that is called on their death.

Then have an actor => an enemy manger that binds to the dispatch and calls an event on enemy death

enemyCounter.zip (152.2 KB)

Click to destroy enemies.

The bp could be optimized to cache the ui into a map and just use that as a target instead of recreating it but it’s not worth the effort for a test project

UI

Thanks so much! I’ll check these solutions out and will update when I do.