Greetings,
I’m having a little issue that has been plaguing me for a while now. I’m adding some custom logic to a certain Actor
in order to extend it and create a “Pickup” class (that will, by default, manage all kind of animations, shine and whatnot).
My class has a defined UStaticMeshComponent
in order to handle this:
UPROPERTY(VisibleDefaultsOnly, Category = Logic)
UStaticMeshComponent* PickupMesh;
Then, in Pickup
's constructor:
FObjectInitializer* init = new FObjectInitializer();
PickupMesh =
init->CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("PickupMesh"));
PickupMesh->SetSimulatePhysics(false);
PickupMesh->AttachTo(RootComponent);
Here’s the thing: When I create a blueprint choosing my GE_Pickup
class as Parent class and assign a mesh to PickupMesh
it appears for a fraction of a seccond and then disappears. It’s not rendered, though it remains assigned. The really curious part about this is that if I duplicate PickupMesh the new one works correctly, appearing and floating as expected.
Any idea as to what am I missing?