How to set Static Mesh in Add Static Mesh Component with variable

I’m creating a blueprint what will randomly spawn trees, I have six different types of trees but the only way I can figure how to do this is by having six different 'Add Static Mesh Components that are all identical in every way except the static mesh. Is there any way I can just set the static mesh as a variable.
I’m fairly new at this so I may need a fairly detailed explanation, maybe.

Firsting first you need to pack all tree variants to an array
And then you can pick a random tree from this array, simply by using a random node

1 Like



is there a way to do this with Child Blueprints? For example if the trees wernt static meshes but blueprint references?

1 Like

Yes, totally possible, but it really means what you mean by ‘child blueprints’

If you mean, do what you see here, but with blueprints, you can have an array of classes, and just spawn the blueprints.

But if you actually mean ‘child actor components’, yes it’s still possible, but much more of a pain. Child actors are a bit of a pain to work with.