"Cast to blueprint" being a variable rather that hardcoded

Hello.

I have a blueprint that needs to influence other blueprints. I’m trying to aim for as tidy of code as I can.

So I need to cast to a blueprint but I might not know which one, so these possible objects are stored in an array. However whenever I want to Cast to I always only have a premade choice rathen than being able to plug into whichever object I want to.

Something like this. Is there no way around this? If I have 50 odd enemy blueprint types I have to manually hard code each cast to with a ton of branches? There’s gotta be a more elegant way of doing this…

Do all the enemies inherit from one parent? You can just cast to the parent to check then…

or

1 Like

ClockworkOcean

36m

Do all the enemies inherit from one parent? You can just cast to the parent to check then…

or

no, I have them as blueprint actors themselves. I am using “cast to” to update values in the blueprints induvidually.

Then maybe have them implement an interface with a function called “update values” and just call that function without casting? The class of the actor won’t matter as long as it implements the interface function. It’s also more performant.