How to attach scripts and additional components in Unreal to a custom made .fbx file from Maya.

Hello world! I have this grid blueprint, where I have 100 cells in it. I would like to add a Box Collision component to each cell, however the only way I can find doing this, is by manually clicking each Cell (StaticMeshComponent) and then clicking “Add component” and the adding the “Box Collision” component:

  1. Is there a way I can somehow add the component via script? I tried to do write the following code in the constructor,

TArray<UStaticMeshComponent*> StaticMeshComponents; GetComponents<UStaticMeshComponent>(StaticMeshComponents);
so I can use “CreateDefaultSubobject<UBoxComponent>” under each Cell (StaticMeshComponent). BUT the problem with that is that the TArray<UStaticMeshComponent* > StaticMeshComponents is empty as the Cells are not yet initialized by the time the constructor is executed.

  1. The other thing I tried was to select all Cells (StaticMeshComponent) in the and try to click add box collision, but it adds the new box collision component to only 1 of the 100 selected Cells.

What would you suggest doing in this case? Also MAYBE I have to setup the whole grid in a different way so I can edit the Cells themselves? But in that case how can I make it so they have exactly the asthetic view I want them to have achieved from Maya?

I also tried creating this blueprint construction function, which creates the components, but I can only see their outline and can not select them so I can edit them in the editor:

hi @sytix

I might not be understanding you correctly forgive me if im not.

Create a single cell as a blueprint actor, add the box collision component.
Populate your world with this new actor instead of the static meshes!

you can use the same code inside this actor as you did before or a variation of it for any interaction of your cells.

this gives each cell a possibility of its own identity and code if they have different actions
instead of a blueprint that handles all the meshes.