Greetings,
I have a C++ component which is supposed to modify an HDRI Backdrop’s cubemap. The component is added to the HDRI Backdrop itself. I’m struggling to understand how to access the blueprint’s fields.
My first idea was using GetOwner and casting it to HDRI Backdrop to access the fields. Soon I realized blueprint types aren’t 1:1 with the C++ side.
Some other forum questions about accessing blueprint fields suggested using FindField; however none of them started from an AActor (the type returned by GetOwner).
On top of that, hovering my mouse on UStructProperty and related stuff on Visual Studio shows the macros are marked as deprecated, but I can’t find any “newer” alternative.
My current non-working code is the following:
UStructProperty* property = FindField<UStructProperty>(GetOwner()->GetClass(), L"Cubemap");
if (property == nullptr)
{
property = FindField<UStructProperty>(GetOwner()->GetClass(), L"cubemap");
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString{"This component must be inside an Actor which holds a \"cubemap\" field."}); return;
return;
}
*property->ContainerPtrToValuePtr<UTextureCube*>((UObject*)GetOwner()) = texture;
The property variable is always nullpointer.
Any suggestion on how to solve, possibly explaining what I’m doing wrong?
Thanks