Get actor of different classes into one array unreal engine 4

i have 10 actor of BP apple and one actor of another BP class eg orange. i want to create array of all the actors. using get all actor of class orange just orange array created, i want to add the apple actor at the end of that array who can i do that. is that possible or i have to create subclass of apple in orange class. i want to perform same actions on all.

i want to perform same actions on all

You will need a Fruit Class first. Then you create an Orange Child and an Apple Child classes.

When you Get All Fruit - you’ll get both Oranges and Apples, and can call shared functionality defined in Fruit. You will not be able to access Orange’s or Apple’s unique functionality unless you cast, though.

For Apples and Oranges, I’d use inheritance since they will be sharing common functionality, they’re all fruit.


If you wanted an Apple and a Car to react to the same call, consider looking into Interfaces - these allow the unrelated classes to communicate.

Although I’d highly recommend Everynone’s answer, alternatively if your looking to do it without inheritance you can pull of the array pin from the “get all actors of class” node and select the “append array” option, it’ll add them both together. However you’ll have to pass the array output into a “actor” array reference because they’re both seperate classes.