Download

[Request] Get a variable from an unknown actor

First off, why is the actor ‘unknown’?

Well say I have an array which has many actors of different types BUT I know they all have an actor variable called ‘center’.

Within a ForEachLoop I would like to get this variable ‘center’ and do whatever.

Right now I have to do this chain just to return the ‘center’ variable :confused:

I’m sure there’s a way of doing this already using inheritance, if all the blueprint actors are children of a base class blueprint that contains the shared variable and any shared functions, you should be able to cast it to the parent and retrieve the variable.

Actually you can already do this with a blueprint interface.

It doesn’t matter if the actors are of different type… as long as each actor type has the interface implemented it will return the variable.

An even cleaner solution than mine! :slight_smile:

TK-Master thank you for introducing me to the world of blueprint interfaces! These are going o be so useful :smiley:

I’ve got it working nicely, you can even call custom events! It’s time to clean up all these chains now.