diff --git a/Unreal/Plugins/PS_Editor/Source/PS_Editor/UI/Widgets/PS_Editor_MainWidget.cpp b/Unreal/Plugins/PS_Editor/Source/PS_Editor/UI/Widgets/PS_Editor_MainWidget.cpp index 52724cc..201df7c 100644 --- a/Unreal/Plugins/PS_Editor/Source/PS_Editor/UI/Widgets/PS_Editor_MainWidget.cpp +++ b/Unreal/Plugins/PS_Editor/Source/PS_Editor/UI/Widgets/PS_Editor_MainWidget.cpp @@ -589,9 +589,10 @@ TSharedRef UPS_Editor_MainWidget::BuildSceneButtons() // Store scene name in GameInstance subsystem (survives OpenLevel) FString BaseLevel = EditorPC->CurrentBaseLevel; + UE_LOG(LogTemp, Warning, TEXT("PS_Editor Play: BaseLevel='%s'"), *BaseLevel); if (BaseLevel.IsEmpty()) { - UE_LOG(LogTemp, Warning, TEXT("PS_Editor: No BaseLevel set, cannot Play. CurrentBaseLevel is empty.")); + UE_LOG(LogTemp, Warning, TEXT("PS_Editor: No BaseLevel set, cannot Play.")); return FReply::Handled(); } @@ -611,11 +612,16 @@ TSharedRef UPS_Editor_MainWidget::BuildSceneButtons() } } - // Reset input mode before transition so the target GameMode starts clean + // Unload sublevel before OpenLevel to avoid name conflict + EditorPC->LoadBaseLevelAsSublevel(TEXT("None")); + + // Reset input mode before transition EditorPC->bShowMouseCursor = false; EditorPC->SetInputMode(FInputModeGameOnly()); - UGameplayStatics::OpenLevel(EditorPC, FName(*BaseLevel), true, TEXT("")); + // Use full path to avoid confusion with sublevel instances + FString MapPath = FString::Printf(TEXT("/Game/%s"), *BaseLevel); + UGameplayStatics::OpenLevel(EditorPC, FName(*MapPath), true, TEXT("")); return FReply::Handled(); }) [