UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
WorldPartitionLevelHelper.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
10#pragma once
11
12#include "Engine/World.h"
17
19class UWorldPartition;
21
23{
24public:
26 ENGINE_API static FString AddActorContainerID(const FActorContainerID& InContainerID, const FString& InActorName);
27
28#if WITH_EDITOR
29public:
30 static FWorldPartitionLevelHelper& Get();
31
33 {
34 ~FPackageReferencer() { RemoveReferences(); }
35
36 void AddReference(UPackage* InPackage);
37 void RemoveReferences();
38 };
39
40 static ULevel* CreateEmptyLevelForRuntimeCell(const UWorldPartitionRuntimeCell* Cell, const UWorld* InWorld, const FString& InWorldAssetName, UPackage* DestPackage = nullptr);
43
44 UE_DEPRECATED(5.4, "LoadActors is deprecated, LoadActors with FLoadActorsParams should be used instead.")
46
47 /* Struct of optional parameters passed to LoadActors function. */
49 {
51 : OuterWorld(nullptr)
52 , DestLevel(nullptr)
53 , PackageReferencer(nullptr)
54 , bLoadAsync(false)
56 , AsyncRequestIDs(nullptr)
57 {}
58
59 UWorld* OuterWorld;
62 FPackageReferencer* PackageReferencer;
63 TFunction<void(bool)> CompletionCallback;
64 bool bLoadAsync;
66 TArray<int32>* AsyncRequestIDs;
67 mutable FLinkerInstancingContext InstancingContext;
68
69 FLoadActorsParams& SetOuterWorld(UWorld* InOuterWorld) { OuterWorld = InOuterWorld; return *this; }
73 FLoadActorsParams& SetCompletionCallback(TFunction<void(bool)> InCompletionCallback) { CompletionCallback = InCompletionCallback; return *this; }
75 {
77 AsyncRequestIDs = OutAsyncRequestIDs;
78 return *this;
79 }
81 FLoadActorsParams& SetInstancingContext(FLinkerInstancingContext InInstancingContext) { InstancingContext = InInstancingContext; return *this; }
82 };
83
84 static bool LoadActors(const FLoadActorsParams& InParams);
85
87
88private:
90
91 void AddReference(UPackage* InPackage, FPackageReferencer* InReferencer);
92 void RemoveReferences(FPackageReferencer* InReferencer);
93 void PreGarbageCollect();
94
96
97 friend class FContentBundleEditor;
99
101 {
103 };
104
105 static bool LoadActors(FLoadActorsParams&& InParams);
108
109 struct FPackageReference
110 {
111 TSet<FPackageReferencer*> Referencers;
113 };
114
115 friend struct FPackageReferencer;
116
118
120
122
124 friend class UWorldPartitionSubsystem;
127 // Cache of Property Overrides to apply after ReRunConstructionScript
128 // In PIE this will be done when Streaming state changes to Visible on the UWorldPartitionLevelStreamingDynamic
129 // In Cook this will be done on save of the Level cell
131 {
132 public:
135
138 inline bool IsDefault()
139 {
140 return ActorPropertyOverrides.IsEmpty();
141 }
142 };
144
145 // Apply Existing Property Override annotation to Actor
147#endif
148};
149
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
Definition Actor.h:257
Definition LinkerInstancingContext.h:99
Definition UObjectAnnotation.h:33
Definition WorldPartitionLevelHelper.h:23
static ENGINE_API FString AddActorContainerIDToSubPathString(const FActorContainerID &InContainerID, const FString &InSubPathString)
Definition WorldPartitionLevelHelper.cpp:53
static ENGINE_API FString AddActorContainerID(const FActorContainerID &InContainerID, const FString &InActorName)
Definition WorldPartitionLevelHelper.cpp:47
Definition ArrayView.h:139
Definition Array.h:670
Definition AndroidPlatformMisc.h:14
Definition UnrealString.h.inl:34
Definition Level.h:423
Definition Package.h:216
Definition HLODSourceActorsFromCell.h:12
Definition WorldPartitionLevelStreamingDynamic.h:26
Definition WorldPartitionRuntimeCell.h:236
Definition WorldPartitionRuntimeLevelStreamingCell.h:17
Definition WorldPartitionSubsystem.h:52
Definition WorldPartition.h:142
Definition World.h:918
Definition WorldPartitionActorContainerID.h:44
Definition AsyncLoading2.cpp:676
Definition SoftObjectPath.h:56
Definition WorldInitializationValues.h:9
Definition WeakObjectPtrTemplates.h:25