Array of different child, same parents


I have an actor parents class named “Ball” and i made 2 childrens of this class :

  • “BallFire”
  • “WaterBall”

I would like to make an array with which contain “BallFire” and “WaterBall” in BP. But I don’t know which type chose in BP,


Should I make an Array of actor pointer ?.. Is it possible in BP ?

You should create an array of the parent object type, which in this case is “Ball”. This way your array can have actors created from any of its child classes.

Hi Stormrage

I tried it, but i can’t change the elements of the array.

Alright, so that’s because the elements in the array have to be actors that are present in the level. You can expose this variable to the editor by setting the Instance Editable property of the variable to True. Then add this blueprint that contains the array into your level.

Now if you click on this actor, you will see the array in its details panel (like the Spawn Points array in the screenshot). Just click on the elements and select the child actors from the drop-down that pops up (assuming actors of the child classes are also present in the level).

Hi Stormrage

Sorry for the late answer (lof of stuff to do here eheh).

So if i don’t have the actors in scene, I can’t do it ? (I found another solution, but its just for my personnal knowledge).

Well, you will need actors placed on the scene if you’re trying to populate it from the editor. When you declare a variable as an actor, it will need a reference to something that actually exists in the world. If it’s at runtime though, you can just spawn actors of those classes and then add it to the array.