I have following code:
.h
UDecalComponent * SelectionMarkerDecal;
UMaterial * SelectionMaterial;
UMaterialInstance * MaterialInstance;
.cpp
static ConstructorHelpers::FObjectFinder<UMaterial>MaterialInstanceObj(TEXT("Material'/Game/TopDown/Materials/Decal_CurrentMarker.Decal_CurrentMarker'"));
if (MaterialInstanceObj.Succeeded())
{
SelectionMaterial = MaterialInstanceObj.Object;
MaterialInstance = UMaterialInstanceDynamic::Create(SelectionMaterial, this);
}
SelectionMarkerDecal = CreateDefaultSubobject<UDecalComponent>(TEXT("Selection Decal"));
SelectionMarkerDecal->AttachTo(RootComponent);
static ConstructorHelpers::FObjectFinder<UDecalComponent>SelectMarkerObj(TEXT("Texture2D'/Game/TopDown/Textures/Marker_Current.Marker_Current'"));
if (SelectMarkerObj.Succeeded())
{
SelectionMarkerDecal->SetDecalMaterial(MaterialInstance);
}
But my decal is always NULL. What is the proper way to initilize Decals?
Docs are not very helpful, when it comes to c++.
Thank you.