Strange behaviour of UUserWidget::CreateWidgetInstance

If UUserWidget::CreateWidgetInstance called a few times with the same name parameter, it creates a new widget instance only first time, following calls return a pointer to a previously created widget without any errors or warnings.

Test code:
UUserWidget* Widget1 = UUserWidget::CreateWidgetInstance( *this->GetWorld(), UMyUserWidget::StaticClass(), "TestNameOne" );
UUserWidget* Widget2 = UUserWidget::CreateWidgetInstance( *this->GetWorld(), UMyUserWidget::StaticClass(), "TestNameOne" );
UUserWidget* Widget3 = UUserWidget::CreateWidgetInstance( *this->GetWorld(), UMyUserWidget::StaticClass(), "TestNameTwo" );
UE_LOG( LogTemp, Log, TEXT( "%s" ), (Widget1 == Widget2 ? TEXT( "TRUE" ) : TEXT( "FALSE" )) );
UE_LOG( LogTemp, Log, TEXT( "%s" ), (Widget2 == Widget3 ? TEXT( "TRUE" ) : TEXT( "FALSE" )) );
Output is TRUE FALSE.

If this is a Create method, I expect it to create a new instance, not to return a pointer to the existing one.
Is it a bug or it should be like this?

I didnt know about this function but you prolly should be 7sing the global CreateWidget《》function

Thanks for the tip, this function is really solving names problem (also, using NAME_None helps too). Though, CreateWidgetInstance behavior is still pretty strange, as for me.

Well yes because FNames are unique, you cannot create 2 objects with the same fname so the function just returns the one created previously

Oh, I see, thanks for explaining