Hi,
I need to create a StaticMeshComponent in real time. I don’t want to declare it as a component inside the header file because I will have a few instances of this, so I took a look at the LoadObject method but I can’t get it to work. I did this :
UStaticMesh * StaticMesh = LoadObject<UStaticMesh>(NULL, TEXT("/Game/PathToMyMesh"), NULL, LOAD_None, NULL);
UStaticMeshComponent* Test = ConstructObject<UStaticMeshComponent>(UStaticMeshComponent::StaticClass());
Test ->SetStaticMesh(StaticMesh);
Test ->AttachTo(RootComponent);
Unfortunately I can see no trace of the mesh inside the game. Is this the right way to do it ?
The “Test” component is correctly initialized when I take a look in the debugger, it is just invisible.