Hi.
I created cpp Actor class and derived BP class from it.
I want to set UStaticMesh in BP and manage SetStaticMesh logic in BP. Nothing I tried leaded to result I would like.
header:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Projectile)
class UStaticMeshComponent* ComponentCoreMesh;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Projectile)
UStaticMesh* CoreMesh;
constructor:
ComponentCoreMesh = ObjectInitializer.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("CoreMesh"));
ComponentCoreMesh->SetStaticMesh(CoreMesh);
ComponentCoreMesh->SetupAttachment(RootComponent);
What I expect: After I set UStaticMesh to UStaticMeshComponent in constructor I would see my change in Viewport.
What I got: Viewport shows no change. But after spawn it works fine.
And since UStaticMeshComponent is inherited, I can’t use transform. So is there a way to change inherited values in BP? ( by some UPROPERTY property ? )
And mainly, is there a way to call constructor in cpp to see result in BP Viewport ?
Thanks a lot.