MCPcopy Create free account
hub / github.com/BenPyton/ProceduralDungeon / LoadInstance

Method LoadInstance

Source/ProceduralDungeon/Private/Room.cpp:1021–1042  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1019}
1020
1021ULevelStreamingDynamic* URoom::LoadInstance(UObject* WorldContextObject, const TSoftObjectPtr<UWorld>& Level, const FString& InstanceNameSuffix, FVector Location, FRotator Rotation)
1022{
1023 DungeonLog_InfoSilent("[W:%s] Loading LevelStreamingDynamic", *GetNameSafe(WorldContextObject));
1024
1025 if (Level.IsNull())
1026 {
1027 DungeonLog_Error("Failed to load level instance: Level is invalid.");
1028 return nullptr;
1029 }
1030
1031 bool success = false;
1032 ULevelStreamingDynamic* Instance = ULevelStreamingDynamic::LoadLevelInstanceBySoftObjectPtr(WorldContextObject, Level, Location, Rotation, success, InstanceNameSuffix);
1033 Instance->bDisableDistanceStreaming = true; // Make sure the level will not be streamed out by distance. We have our own streaming logic.
1034
1035 if (!success)
1036 {
1037 DungeonLog_Error("Failed to load level instance: Unknown reason");
1038 return nullptr;
1039 }
1040
1041 return Instance;
1042}
1043
1044void URoom::UnloadInstance(ULevelStreamingDynamic* Instance)
1045{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected