Here is what turned out to work for me.
In my component constructor I load the assets and assign them to my properties:
struct FConstructorStatics
{
ConstructorHelpers::FObjectFinderOptional<UTexture> TextureFinder;
ConstructorHelpers::FObjectFinderOptional<UMaterial> MaterialFinder;
FConstructorStatics()
: TextureFinder(TEXT("Texture2D'/Game/Textures/2DBackground.2DBackground'"))
, MaterialFinder(TEXT("Material'/Game/Materials/DynamicTextureMaterial.DynamicTextureMaterial'"))
{
}
};
static FConstructorStatics ConstructorStatics;
Texture = ConstructorStatics.TextureFinder.Get();
UMaterial* Material = ConstructorStatics.MaterialFinder.Get();
DynamicMaterial = UMaterialInstanceDynamic::Create(Material, this);
Then in my component’s PostLoad I apply them:
DynamicMaterial->SetTextureParameterValue(FName("DynamicTexture"), Texture);
Mesh->SetMaterial(0, DynamicMaterial);
Thanks Duncan and Rajko for the suggestions!