Make testplay start at Default Map?

Hi there…

I´m not new to Unreal and got much experienced with the Engine… and the Editor…
But in my Years i never figured this out…

I´ve two Maps.
00_Debugging
01_Main

In the project Preferences, i set:
01

Which opens the Debugging level when i start the Unreal Editor… and my Standalone Game starts at the Main Map.

And there is the problem… Those are the only two Options…

Now… in the Editor we have this nice Button set:
02

And this… is the annyoing Part… When you Hit the Testplay here, option for new PIE Window checked… networking in standalone, it only starts the current opened level…
But… that´s a problem if you need to Debug some things on one map… but need to do Network Create/Find/Join Session, after changing ingame settings in the main menu…
You always need to switch from debugging to main to debugging to main…etc… cause there seems no option to make the Editor Testplay start the Default Standalone Startup Map…

Do you now how to deal with that…? I mean… make testplay always start at a specific Level, instead of the currently loaded one?

I use a Cheat Code (or console command) that lets me restart the game. When I want to test play, I begin on the current map and then trigger the cheat code.

Here is the C++ code:

class THEPATHTOL0_API UL0CheatManager : public UCheatManager
{
	UFUNCTION(Exec)
	void L0CheatRestartGame();
};

void UL0CheatManager::L0CheatRestartGame()
{
	UGameMapsSettings const* GameMapsSettings = UGameMapsSettings::GetGameMapsSettings();
	if (ensure(GameMapsSettings))
	{
		const FString DefaultMapName = GameMapsSettings->GetGameDefaultMap();
		UGameplayStatics::OpenLevel(this, FName(*DefaultMapName));
	}
}

This approach offers an added benefit: during events or when packaging the game, I can easily restart it if any bugs arise.

While you can opt for a key-based approach, I find cheat codes more convenient. They’re easier to autocomplete and provide endless possibilities.

Note: I’ve implemented a variety of cheat codes for testing, including ‘SkipOnboarding,’ ‘SetPlayerLevel,’ and ‘GiveEquipment.’ These codes are incredibly convenient for enhancing gameplay and diagnosing issues

I´ve done a Cheat system with Blueprints for now…

On BeginPlay… the PlayerController checks if a Started Switch in the GameInstance is true…

If false… it Opens the Start Level, which then sets the Switch to true…

If already true… it just proceeds with the PlayerController Stuff…

So… each time the PC gets spawned, it asks if the Game started at the Start Map via that Switch… and if not… teleports to that…