How to dynamically set mesh of component created at runtime?

I’m trying to create multiple static mesh components in blueprint at runtime and I can’t find a way to set the mesh they use with a variable - either I have to set the mesh as they’re created or not set them at all. I’ve tried using SetStaticMesh but it only works on components not created with Add StaticMeshComponent. Is there any way to set the mesh without creating a ‘real’ component beforehand?

OK, so I found the solution - you need to drag out wire from the return value of Add StaticMeshComponent to add a mesh for it, otherwise it will only set the mesh for root.