I have an UserWidget window ( with blueprint code ). It call an event “close” when button pressed. And the window closes.
I need to catch this event in my C++ code.
I make a parent C++ class UInventoryWindow for this widget.
The first way was:
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "CloseEvent")
void close();
void close_Implementation();
but does not works. I have a blueprint compilation error
[Compiler] close name conflicts with a native 'InventoryWindow' function
The second way: I overridden the SetVisibility function in my UInventoryWindow class. But it is the bad way
void UInventoryWindow::SetVisibility(ESlateVisibility InVisibility)
{
UGameplayStatics::SetGamePaused(GetWorld(), false );
UUserWidget::SetVisibility(InVisibility);
RemoveFromParent();
}
