UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
DataLayerSubsystem.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
9#include "DataLayerSubsystem.generated.h"
10
16class UCanvas;
17
19
20#if WITH_EDITOR
23#endif
24
26UCLASS(Config = Engine, MinimalAPI)
28{
30
31protected:
32 ENGINE_API virtual bool DoesSupportWorldType(const EWorldType::Type WorldType) const override;
33
34public:
35 //~ Begin Blueprint callable functions
36
38 UE_DEPRECATED(5.3, "Use UDataLayerManager::GetDataLayerInstanceFromAsset instead.")
39 UFUNCTION(BlueprintCallable, Category = DataLayers, meta = (DeprecatedFunction, DeprecationMessage = "DataLayerSubsystem is deprecated, use the equivalent function in DataLayerManager"))
40 ENGINE_API UDataLayerInstance* GetDataLayerInstanceFromAsset(const UDataLayerAsset* InDataLayerAsset) const;
41
42 UE_DEPRECATED(5.3, "Use UDataLayerManager::GetDataLayerInstanceRuntimeState instead.")
43 UFUNCTION(BlueprintCallable, Category = DataLayers, meta = (DeprecatedFunction, DeprecationMessage = "DataLayerSubsystem is deprecated, use the equivalent function in DataLayerManager"))
44 ENGINE_API EDataLayerRuntimeState GetDataLayerInstanceRuntimeState(const UDataLayerAsset* InDataLayerAsset) const;
45
46 UE_DEPRECATED(5.3, "Use UDataLayerManager::GetDataLayerInstanceEffectiveRuntimeState instead.")
47 UFUNCTION(BlueprintCallable, Category = DataLayers, meta = (DeprecatedFunction, DeprecationMessage = "DataLayerSubsystem is deprecated, use the equivalent function in DataLayerManager"))
48 ENGINE_API EDataLayerRuntimeState GetDataLayerInstanceEffectiveRuntimeState(const UDataLayerAsset* InDataLayerAsset) const;
49
51 UE_DEPRECATED(5.3, "Use UDataLayerManager::SetDataLayerInstanceRuntimeState instead.")
52 UFUNCTION(BlueprintCallable, Category = DataLayers, BlueprintAuthorityOnly, meta = (DeprecatedFunction, DeprecationMessage = "DataLayerSubsystem is deprecated, use the equivalent function in DataLayerManager"))
53 ENGINE_API void SetDataLayerInstanceRuntimeState(const UDataLayerAsset* InDataLayerAsset, EDataLayerRuntimeState InState, bool bInIsRecursive = false);
54
56 UE_DEPRECATED(5.3, "Use UDataLayerManager::OnDataLayerInstanceRuntimeStateChanged instead.")
57 UPROPERTY(BlueprintAssignable)
58 FOnDataLayerRuntimeStateChanged OnDataLayerRuntimeStateChanged;
59
60 //~ End Blueprint callable functions
61
62 template<class T>
63 UE_DEPRECATED(5.3, "Use UDataLayerManager::GetDataLayerInstance instead.")
64 UDataLayerInstance* GetDataLayerInstance(const T& InDataLayerIdentifier, const ULevel* InLevelContext = nullptr) const;
65
66 template<class T>
67 UE_DEPRECATED(5.3, "Use UDataLayerManager::GetDataLayerInstances instead.")
68 TArray<const UDataLayerInstance*> GetDataLayerInstances(const TArray<T>& InDataLayerIdentifiers, const ULevel* InLevelContext = nullptr) const;
69
70 template<class T>
71 UE_DEPRECATED(5.3, "Use UDataLayerManager::GetDataLayerInstanceNames instead.")
72 TArray<FName> GetDataLayerInstanceNames(const TArray<T>& InDataLayerIdentifiers, const ULevel* InLevelContext = nullptr) const;
73
74 UE_DEPRECATED(5.3, "This function has been deprecated.")
75 ENGINE_API const UDataLayerInstance* GetDataLayerInstanceFromAssetName(const FName& InDataLayerAssetPathName) const;
76
77 UE_DEPRECATED(5.3, "Use UDataLayerManager::SetDataLayerRuntimeState instead.")
78 ENGINE_API void SetDataLayerRuntimeState(const UDataLayerInstance* InDataLayerInstance, EDataLayerRuntimeState InState, bool bInIsRecursive = false);
79
80 UE_DEPRECATED(5.3, "Use UDataLayerManager::GetDataLayerRuntimeState instead.")
81 ENGINE_API EDataLayerRuntimeState GetDataLayerRuntimeState(const UDataLayerInstance* InDataLayer) const;
82
83 UE_DEPRECATED(5.3, "Use UDataLayerManager::GetDataLayerRuntimeStateByName instead.")
84 ENGINE_API EDataLayerRuntimeState GetDataLayerRuntimeStateByName(const FName& InDataLayerName) const;
85
86 UE_DEPRECATED(5.3, "Use UDataLayerManager::GetDataLayerEffectiveRuntimeState instead.")
87 ENGINE_API EDataLayerRuntimeState GetDataLayerEffectiveRuntimeState(const UDataLayerInstance* InDataLayer) const;
88
89 UE_DEPRECATED(5.3, "Use UDataLayerManager::GetDataLayerEffectiveRuntimeStateByName instead.")
90 ENGINE_API EDataLayerRuntimeState GetDataLayerEffectiveRuntimeStateByName(const FName& InDataLayerName) const;
91
92 UE_DEPRECATED(5.3, "Use UDataLayerManager::IsAnyDataLayerInEffectiveRuntimeState instead.")
93 ENGINE_API bool IsAnyDataLayerInEffectiveRuntimeState(const TArray<FName>& InDataLayerNames, EDataLayerRuntimeState InState) const;
94
95 UE_DEPRECATED(5.3, "Use UDataLayerManager::GetEffectiveActiveDataLayerNames instead.")
96 ENGINE_API const TSet<FName>& GetEffectiveActiveDataLayerNames() const;
97
98 UE_DEPRECATED(5.3, "Use UDataLayerManager::GetEffectiveLoadedDataLayerNames instead.")
99 ENGINE_API const TSet<FName>& GetEffectiveLoadedDataLayerNames() const;
100
101 UE_DEPRECATED(5.3, "This function has been deprecated.")
102 void GetDataLayerDebugColors(TMap<FName, FColor>& OutMapping) const {}
103
104 UE_DEPRECATED(5.3, "This function has been deprecated.")
105 ENGINE_API void DrawDataLayersStatus(UCanvas* Canvas, FVector2D& Offset) const;
106
107 UE_DEPRECATED(5.3, "This function has been deprecated.")
108 ENGINE_API void DumpDataLayers(FOutputDevice& OutputDevice) const;
109
110 UE_DEPRECATED(5.3, "This function has been deprecated.")
111 void RegisterWorldDataLayer(AWorldDataLayers* WorldDataLayers) {}
112
113 UE_DEPRECATED(5.3, "This function has been deprecated.")
114 void UnregisterWorldDataLayer(AWorldDataLayers* WorldDataLayers) {}
115
116 UE_DEPRECATED(5.3, "This function has been deprecated.")
117 void ForEachWorldDataLayer(TFunctionRef<bool(AWorldDataLayers*)> Func) {}
118
119 UE_DEPRECATED(5.3, "This function has been deprecated.")
120 void ForEachWorldDataLayer(TFunctionRef<bool(AWorldDataLayers*)> Func) const {}
121
122 UE_DEPRECATED(5.3, "This function has been deprecated.")
123 void ForEachDataLayer(TFunctionRef<bool(UDataLayerInstance*)> Func, const ULevel* InLevelContext = nullptr) {}
124
125 UE_DEPRECATED(5.3, "This function has been deprecated.")
126 void ForEachDataLayer(TFunctionRef<bool(UDataLayerInstance*)> Func, const ULevel* InLevelContext = nullptr) const {}
127
128#if WITH_EDITOR
129 UE_DEPRECATED(5.3, "This function has been deprecated.")
131
132 UE_DEPRECATED(5.3, "This function has been deprecated.")
133 bool ResolveIsLoadedInEditor(const TArray<FName>& InDataLayerInstanceNames) const { return false; }
134
135 UE_DEPRECATED(5.3, "This function has been deprecated.")
136 bool CanResolveDataLayers() const { return false; }
137
138 UE_DEPRECATED(5.3, "This function has been deprecated.")
139 bool RemoveDataLayer(const UDataLayerInstance* InDataLayer) { return false; }
140
141 UE_DEPRECATED(5.3, "This function has been deprecated.")
142 int32 RemoveDataLayers(const TArray<UDataLayerInstance*>& InDataLayerInstances) { return 0; }
143
144 UE_DEPRECATED(5.3, "This function has been deprecated.")
146
147 UE_DEPRECATED(5.3, "This function has been deprecated.")
149
150 UE_DEPRECATED(5.3, "This function has been deprecated.")
152
153 UE_DEPRECATED(5.3, "This function has been deprecated.")
154 void PopActorEditorContext() const {}
155
156 UE_DEPRECATED(5.3, "This function has been deprecated.")
157 TArray<UDataLayerInstance*> GetActorEditorContextDataLayers() const { return TArray<UDataLayerInstance*>(); }
158
159 UE_DEPRECATED(5.3, "This function has been deprecated.")
160 uint32 GetDataLayerEditorContextHash() const { return 0; }
161#endif
162
163 PRAGMA_DISABLE_DEPRECATION_WARNINGS // Suppress compiler warning on override of deprecated function
164
165 UE_DEPRECATED(5.0, "Use SetDataLayerRuntimeState instead.")
166 UFUNCTION(BlueprintCallable, Category = DataLayers, BlueprintAuthorityOnly, meta = (DeprecatedFunction, DeprecationMessage = "DataLayerSubsystem is deprecated, use the equivalent function in DataLayerManager"))
167 void SetDataLayerState(const FActorDataLayer& InDataLayer, EDataLayerState InState) { SetDataLayerRuntimeState(InDataLayer, (EDataLayerRuntimeState)InState); }
168
169 UE_DEPRECATED(5.0, "Use SetDataLayerRuntimeStateByLabel instead.")
170 UFUNCTION(BlueprintCallable, Category = DataLayers, BlueprintAuthorityOnly, meta = (DeprecatedFunction, DeprecationMessage = "DataLayerSubsystem is deprecated, use the equivalent function in DataLayerManager"))
171 void SetDataLayerStateByLabel(const FName& InDataLayerLabel, EDataLayerState InState) { SetDataLayerRuntimeStateByLabel(InDataLayerLabel, (EDataLayerRuntimeState)InState); }
172
173 UE_DEPRECATED(5.0, "Use GetDataLayerRuntimeState instead.")
174 UFUNCTION(BlueprintCallable, Category = DataLayers, meta = (DeprecatedFunction, DeprecationMessage = "DataLayerSubsystem is deprecated, use the equivalent function in DataLayerManager"))
175 EDataLayerState GetDataLayerState(const FActorDataLayer& InDataLayer) const { return (EDataLayerState)GetDataLayerRuntimeState(InDataLayer); }
176
177 UE_DEPRECATED(5.0, "Use GetDataLayerRuntimeStateByLabel instead.")
178 UFUNCTION(BlueprintCallable, Category = DataLayers, meta = (DeprecatedFunction, DeprecationMessage = "DataLayerSubsystem is deprecated, use the equivalent function in DataLayerManager"))
179 EDataLayerState GetDataLayerStateByLabel(const FName& InDataLayerLabel) const { return (EDataLayerState)GetDataLayerRuntimeStateByLabel(InDataLayerLabel); }
180
181 UE_DEPRECATED(5.0, "Use GetDataLayerRuntimeState instead.")
182 EDataLayerState GetDataLayerState(const UDataLayerInstance* InDataLayer) const { return (EDataLayerState)GetDataLayerRuntimeState(InDataLayer); }
183
184 UE_DEPRECATED(5.0, "Use UDataLayerManager::GetDataLayerInstanceRuntimeState instead.")
185 EDataLayerState GetDataLayerStateByName(const FName& InDataLayerName) const { return (EDataLayerState)GetDataLayerRuntimeStateByName(InDataLayerName); }
186
187 UE_DEPRECATED(5.0, "Use UDataLayerManager::IsAnyDataLayerInEffectiveRuntimeState instead.")
188 bool IsAnyDataLayerInState(const TArray<FName>& InDataLayerNames, EDataLayerState InState) const { return IsAnyDataLayerInEffectiveRuntimeState(InDataLayerNames, (EDataLayerRuntimeState)InState); }
189
191
192 UE_DEPRECATED(5.0, "GetActiveDataLayerNames will be removed.")
193 UFUNCTION(BlueprintCallable, Category = DataLayers, meta = (DeprecatedFunction, DeprecationMessage = "GetActiveDataLayerNames will be removed."))
194 const TSet<FName>& GetActiveDataLayerNames() const { static TSet<FName> EmptySet; return EmptySet; }
195
196 UE_DEPRECATED(5.0, "GetLoadedDataLayerNames will be removed.")
197 UFUNCTION(BlueprintCallable, Category = DataLayers, meta = (DeprecatedFunction, DeprecationMessage = "GetLoadedDataLayerNames will be removed."))
198 const TSet<FName>& GetLoadedDataLayerNames() const { static TSet<FName> EmptySet; return EmptySet; }
199
200 UE_DEPRECATED(5.1, "Use GetDataLayerInstanceFromAsset instead.")
201 UFUNCTION(BlueprintCallable, Category = DataLayers, meta = (DeprecatedFunction, DeprecationMessage = "DataLayerSubsystem is deprecated, use GetDataLayerInstanceFromAsset in DataLayerManager"))
202 ENGINE_API UDataLayerInstance* GetDataLayer(const FActorDataLayer& InDataLayer) const;
203
204 UE_DEPRECATED(5.1, "Use GetDataLayerInstanceFromAsset instead.")
205 UFUNCTION(BlueprintCallable, Category = DataLayers, meta = (DeprecatedFunction, DeprecationMessage = "DataLayerSubsystem is deprecated, use GetDataLayerInstanceFromAsset in DataLayerManager"))
206 ENGINE_API UDataLayerInstance* GetDataLayerFromName(FName InDataLayerName) const;
207
208 UE_DEPRECATED(5.1, "Use GetDataLayerInstanceFromAsset instead.")
209 UFUNCTION(BlueprintCallable, Category = DataLayers, meta = (DeprecatedFunction, DeprecationMessage = "DataLayerSubsystem is deprecated, use GetDataLayerInstanceFromAsset in DataLayerManager"))
210 ENGINE_API UDataLayerInstance* GetDataLayerFromLabel(FName InDataLayerLabel) const;
211
212 UE_DEPRECATED(5.1, "Use GetDataLayerInstanceRuntimeState instead.")
213 UFUNCTION(BlueprintCallable, Category = DataLayers, meta = (DeprecatedFunction, DeprecationMessage = "DataLayerSubsystem is deprecated, use GetDataLayerInstanceRuntimeState in DataLayerManager"))
214 ENGINE_API EDataLayerRuntimeState GetDataLayerRuntimeState(const FActorDataLayer& InDataLayer) const;
215
216 UE_DEPRECATED(5.1, "Use GetDataLayerInstanceRuntimeState instead.")
217 UFUNCTION(BlueprintCallable, Category = DataLayers, meta = (DeprecatedFunction, DeprecationMessage = "DataLayerSubsystem is deprecated, use GetDataLayerInstanceRuntimeState in DataLayerManager"))
218 ENGINE_API EDataLayerRuntimeState GetDataLayerRuntimeStateByLabel(const FName& InDataLayerLabel) const;
219
220 UE_DEPRECATED(5.1, "Use GetDataLayerInstanceEffectiveRuntimeState instead.")
221 UFUNCTION(BlueprintCallable, Category = DataLayers, meta = (DeprecatedFunction, DeprecationMessage = "DataLayerSubsystem is deprecated, use GetDataLayerInstanceEffectiveRuntimeState in DataLayerManager"))
222 ENGINE_API EDataLayerRuntimeState GetDataLayerEffectiveRuntimeState(const FActorDataLayer& InDataLayer) const;
223
224 UE_DEPRECATED(5.1, "Use GetDataLayerInstanceEffectiveRuntimeState instead.")
225 UFUNCTION(BlueprintCallable, Category = DataLayers, meta = (DeprecatedFunction, DeprecationMessage = "DataLayerSubsystem is deprecated, use GetDataLayerInstanceEffectiveRuntimeState in DataLayerManager"))
226 ENGINE_API EDataLayerRuntimeState GetDataLayerEffectiveRuntimeStateByLabel(const FName& InDataLayerLabel) const;
227
228 UE_DEPRECATED(5.1, "Use SetDataLayerRuntimeState() with UDataLayerAsset* overload instead.")
229 UFUNCTION(BlueprintCallable, Category = DataLayers, BlueprintAuthorityOnly)
230 ENGINE_API void SetDataLayerRuntimeState(const FActorDataLayer& InDataLayer, EDataLayerRuntimeState InState, bool bInIsRecursive = false);
231
232 UE_DEPRECATED(5.1, "Use SetDataLayerInstanceRuntimeState instead.")
233 UFUNCTION(BlueprintCallable, Category = DataLayers, BlueprintAuthorityOnly)
234 ENGINE_API void SetDataLayerRuntimeStateByLabel(const FName& InDataLayerLabel, EDataLayerRuntimeState InState, bool bInIsRecursive = false);
235
236private:
237 UE_DEPRECATED(5.3, "Use UDataLayerManager::DataLayerLoadingPolicyClass instead.")
238 UPROPERTY(Config)
239 TSoftClassPtr<UDataLayerLoadingPolicy> DataLayerLoadingPolicyClass;
240
242};
243
244template<class T>
245UDataLayerInstance* UDataLayerSubsystem::GetDataLayerInstance(const T& InDataLayerIdentifier, const ULevel* InLevelContext /* = nullptr */) const
246{
247 const UDataLayerManager* DataLayerManager = UDataLayerManager::GetDataLayerManager(GetWorld());
248 return DataLayerManager ? const_cast<UDataLayerInstance*>(DataLayerManager->GetDataLayerInstance(InDataLayerIdentifier)) : nullptr;
249}
250
251template<class T>
257
258template<class T>
OODEFFUNC typedef const int const char * function
Definition oodle2.h:710
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
EDataLayerRuntimeState
Definition DataLayerInstance.h:26
#define DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(DelegateName, Param1Type, Param1Name, Param2Type, Param2Name)
Definition DelegateCombinations.h:62
#define DECLARE_MULTICAST_DELEGATE_OneParam(DelegateName, Param1Type)
Definition DelegateCombinations.h:49
#define PRAGMA_ENABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:12
#define PRAGMA_DISABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:8
const bool
Definition NetworkReplayStreaming.h:178
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UFUNCTION(...)
Definition ObjectMacros.h:745
#define UCLASS(...)
Definition ObjectMacros.h:776
uint32 Offset
Definition VulkanMemory.cpp:4033
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition WorldDataLayers.h:85
Definition Engine.Build.cs:7
Definition NameTypes.h:617
Definition UnrealType.h:3087
Definition OutputDevice.h:133
Definition Array.h:670
Definition AssetRegistryState.h:50
Definition UnrealString.h.inl:34
Definition SoftObjectPtr.h:763
Definition Canvas.h:159
FCanvas * Canvas
Definition Canvas.h:221
Definition DataLayerAsset.h:30
Definition DataLayerLoadingPolicy.h:16
Definition DataLayerManager.h:48
static UDataLayerManager * GetDataLayerManager(const T *InObject)
Definition DataLayerManager.h:53
ENGINE_API TArray< UDataLayerInstance * > GetDataLayerInstances() const
Definition DataLayerManager.cpp:259
const UDataLayerInstance * GetDataLayerInstance(const T &InDataLayerIdentifier) const
TArray< FName > GetDataLayerInstanceNames(const TArray< T > &InDataLayerIdentifiers) const
Definition DataLayerManager.h:268
Definition DataLayerSubsystem.h:28
TArray< const UDataLayerInstance * > GetDataLayerInstances(const TArray< T > &InDataLayerIdentifiers, const ULevel *InLevelContext=nullptr) const
Definition DataLayerSubsystem.h:259
TArray< FName > GetDataLayerInstanceNames(const TArray< T > &InDataLayerIdentifiers, const ULevel *InLevelContext=nullptr) const
Definition DataLayerSubsystem.h:252
Definition Level.h:423
Definition WorldSubsystem.h:16
virtual ENGINE_API UWorld * GetWorld() const override final
Definition WorldSubsystem.cpp:23
Definition World.h:918
Type
Definition EngineTypes.h:1264
@ false
Definition radaudio_common.h:23
Definition ActorDataLayer.h:16
Definition Color.h:486