Unfortunately, the UWorld creation code only works once in a packaged game. Further takes off Fatal Error when I try to create the second. This is connected similarly with the function of duplicating the finished Uworld into a new one:
UWorld* PackageWorld = UWorld::FindWorldInPackage(WorldPackage);
UWorld* BlankNewWorld = UWorld::CreateWorld(EWorldType::Game, false);
FObjectDuplicationParameters Parameters(PackageWorld, BlankNewWorld);
//Parameters.DestName = PackageWorld->GetFName();
static int32 i = 1;
auto name = FString("World") + FString::FromInt(i);
Parameters.DestName = *name;
Parameters.DestClass = PackageWorld->GetClass();
Parameters.DuplicateMode = EDuplicateMode::Normal;
Parameters.PortFlags = EPropertyPortFlags::PPF_Duplicate;
i++;
NewWorld = CastChecked<UWorld>(StaticDuplicateObjectEx(Parameters));
Does anyone have any ideas how to make correct duplicates?
