Good Morning,
I have a DataAsset with property:
UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category="SP|Config")
UTexture2D* Icon;
I created some logic that creates Texture2D in a class inheriting from IDetailCustomization. I would now like to assign this texture to Icon property .
FString PackageName;
PreviewTexture = MyRenderTarget->ConstructTexture2D( CreatePackage(*PackageName), Mesh->GetName() + TEXT("_M"), RF_NoFlags, CTF_Default, NULL);
PreviewTexture->AddToRoot();
PreviewTexture->UpdateResource();
SPEditorUtilities::SaveTexture2D(TEXT("/Game/Items/Icons/"), Mesh->GetName(), PreviewTexture, true);
TSharedRef<IPropertyHandle> IconHandle = CachedDetailBuilder->GetProperty("Icon");
IconHandle->SetValue((UObject*)PreviewTexture);
The texture is created correctly and the file appears in the asset browser, but IconHandle->SetValue does not set the texture field in the aset to the newly created asset.
Could someone please help?