Hi all,
Is it possible to access the items within a Widget Blueprint’s Hierarchy from C++, specifically I’m try to access a Param from an image that is using a Material as it’s source?
I’m adding the Widget to the viewport from code and have pointer to the Widget object:
void AMM2PlayerController::BeginPlay()
{
Super::BeginPlay();
if (wIngameUI) // Check if the Asset is assigned in the blueprint.
{
// Create the widget and store it.
MyIngameUI = CreateWidget<UUserWidget>(this, wIngameUI);
// now you can use the widget directly since you have a reference for it.
// Extra check to make sure the pointer holds the widget.
if (MyIngameUI)
{
//let add it to the view port
MyIngameUI->AddToViewport();
}
//Show the Cursor.
bShowMouseCursor = false;
}
}
I’ve tried accessing this from another script and have tried getting it’s slots etc but everything seems to be coming back empty:
if (MyPlayerController)
{
UE_LOG(LogTemp, Warning, TEXT("MyPlayerController: %s"), *MyPlayerController->GetName());
TArray<FName> slots;
MyPlayerController->MyIngameUI->GetSlotNames(slots);
for (int32 i = 0; i < slots.Num(); i++)
{
UE_LOG(LogTemp, Warning, TEXT("Slot Names: %s"), *slots[i].ToString());
}
}
Any help on how I can get to that magical Param within the material, within the UMG would be very gratefully received indeed.
Kindest regards