In my workflow. I have many case to create PackedLevelActor. Sometimes it’s more then hundred.
So I use python script to get actor list and save path for done it with for loop.
I use ULevelInstanceSubsystem to do it. A small problem is every time it run, it alway opens a dialog box to where to save the pakage. I just hope it to save where I setted a path at FNewLevelInstanceParams.LevelPackageName without pops up a dialog box. (By the way it saves me a one dialog box for BPP. originaly it opens two dialog boxs…)
So am I missing something? Anyone Create PackedLevelActor by script? Plz Help.
void MyBPLibrary::CreatePackedLevelActorFromSelectedActors(TArray<AActor*> InActors, AActor* InPivotActor, FString InPath)
{
UWorld* World = GEngine->GetWorldFromContextObject(InActors[0], EGetWorldErrorMode::LogAndReturnNull);
ULevelInstanceSubsystem* LevelInstanceSubsystem = UWorld::GetSubsystem<ULevelInstanceSubsystem>(World);
FNewLevelInstanceParams Parms;
Parms.Type = ELevelInstanceCreationType::PackedLevelActor;
Parms.bAlwaysShowDialog = false;
Parms.bEnableStreaming = false;
Parms.bPromptForSave=false;
Parms.PivotType = ELevelInstancePivotType::Actor;
Parms.PivotActor = InPivotActor;
Parms.LevelPackageName = InPath;
LevelInstanceSubsystem->CreateLevelInstanceFrom(InActors, Parms);
}
## FString InPath = "/Game/Env/Common/TestPackedLevelActor_0"