When i try to run this code below the game makes a world and save this but when i try to open this world it crashes.
What am i doing wrong?
{
FString name = “WorldName”;
FString Path = “/Game/Test/World” + name;
UPackage* Package = CreatePackage(*Path);
UWorld* world = UWorld::CreateWorld(EWorldType::None, false, *name, Package);
world->MarkPackageDirty();
FEditorFileUtils::SaveMap(world, *Path);
Package->SetDirtyFlag(true);
TArray<UPackage*> packagesToSave;
packagesToSave.Add(Package);
FEditorFileUtils::PromptForCheckoutAndSave(packagesToSave, false, false);
}