UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
DataLayer.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
8#include "UObject/Object.h"
9#include "ActorDataLayer.h"
10#include "Math/Color.h"
12
13#include "DataLayer.generated.h"
14
15UENUM(BlueprintType, meta = (ScriptName = "DataLayerStateType"))
16enum class UE_DEPRECATED(5.0, "Use EDataLayerRuntimeState instead.") EDataLayerState : uint8
17{
19 Loaded,
21};
22
23// Used for debugging
43
44static_assert(EDataLayerRuntimeState::Unloaded < EDataLayerRuntimeState::Loaded && EDataLayerRuntimeState::Loaded < EDataLayerRuntimeState::Activated, "Streaming Query code is dependent on this being true");
45
46
47static_assert(DATALAYER_TO_INSTANCE_RUNTIME_CONVERSION_ENABLED, "UDEPRECATED_DataLayer class is deprecated and needs to be deleted.");
48class UE_DEPRECATED(5.1, "Use UDataLayerInstance & UDataLayerAsset to create DataLayers") UDEPRECATED_DataLayer;
49
50UCLASS(Config = Engine, PerObjectConfig, Within = WorldDataLayers, BlueprintType, Deprecated, MinimalAPI)
52{
54
55 friend class UDeprecatedDataLayerInstance;
56
57public:
58#if WITH_EDITOR
59 ENGINE_API virtual bool CanEditChange(const FProperty* Property) const;
60 ENGINE_API virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
61
62 ENGINE_API void SetVisible(bool bIsVisible);
64 ENGINE_API void SetIsRuntime(bool bIsRuntime);
66 void SetIsLocked(bool bInIsLocked) { bIsLocked = bInIsLocked; }
67
68 ENGINE_API bool IsLocked() const;
70 bool IsLoadedInEditor() const { return bIsLoadedInEditor; }
74
78
81#endif
82 const TArray<TObjectPtr<UDEPRECATED_DataLayer>>& GetChildren() const { return Children_DEPRECATED; }
83 ENGINE_API void ForEachChild(TFunctionRef<bool(const UDEPRECATED_DataLayer*)> Operation) const;
84
85 const UDEPRECATED_DataLayer* GetParent() const { return Parent_DEPRECATED; }
86 UDEPRECATED_DataLayer* GetParent() { return Parent_DEPRECATED; }
87
88 ENGINE_API virtual void PostLoad() override;
89
90 UFUNCTION(Category = "Data Layer", BlueprintCallable)
91 bool Equals(const FActorDataLayer& ActorDataLayer) const { return ActorDataLayer.Name == GetFName(); }
92
93 UFUNCTION(Category = "Data Layer", BlueprintCallable)
94 FName GetDataLayerLabel() const { return DataLayerLabel; }
95
96 UFUNCTION(Category = "Data Layer|Editor", BlueprintCallable)
97 ENGINE_API bool IsInitiallyVisible() const;
98
99 UFUNCTION(Category = "Data Layer|Editor", BlueprintCallable)
100 ENGINE_API bool IsVisible() const;
101
102 UFUNCTION(Category = "Data Layer|Editor", BlueprintCallable)
103 ENGINE_API bool IsEffectiveVisible() const;
104
105 UFUNCTION(Category = "Data Layer|Editor", BlueprintCallable)
106 FColor GetDebugColor() const { return DebugColor; }
107
108 UFUNCTION(Category = "Data Layer|Runtime", BlueprintCallable)
109 bool IsRuntime() const { return bIsRuntime; }
110
111 UFUNCTION(Category = "Data Layer|Runtime", BlueprintCallable)
112 EDataLayerRuntimeState GetInitialRuntimeState() const { return IsRuntime() ? InitialRuntimeState : EDataLayerRuntimeState::Unloaded; }
113
114 //~ Begin Deprecated
115
116 UE_DEPRECATED(5.0, "Use IsRuntime() instead.")
117 UFUNCTION(Category = "Data Layer|Runtime", BlueprintCallable, meta = (DeprecatedFunction, DeprecationMessage = "Use IsRuntime instead"))
118 bool IsDynamicallyLoaded() const { return IsRuntime(); }
119
120 UE_DEPRECATED(5.0, "Use GetInitialRuntimeState() instead.")
121 UFUNCTION(Category = "Data Layer|Runtime", BlueprintCallable, meta = (DeprecatedFunction, DeprecationMessage = "Use GetInitialRuntimeState instead"))
122 bool IsInitiallyActive() const { return IsRuntime() && GetInitialRuntimeState() == EDataLayerRuntimeState::Activated; }
123
124 PRAGMA_DISABLE_DEPRECATION_WARNINGS // Suppress compiler warning on override of deprecated function
125 UE_DEPRECATED(5.0, "Use GetInitialRuntimeState() instead.")
126 UFUNCTION(Category = "Data Layer|Runtime", BlueprintCallable, meta = (DeprecatedFunction, DeprecationMessage = "Use GetInitialRuntimeState instead"))
127 EDataLayerState GetInitialState() const { return (EDataLayerState)GetInitialRuntimeState(); }
129
130 //~ End Deprecated
131private:
132
133 void AddChild(UDEPRECATED_DataLayer* DataLayer);
134#if WITH_EDITOR
135 ENGINE_API void RemoveChild(UDEPRECATED_DataLayer* DataLayer);
137#endif
138
139#if WITH_EDITORONLY_DATA
140 UPROPERTY()
142
145 uint32 bIsVisible : 1;
146
148 UPROPERTY(Category = "Data Layer|Editor", EditAnywhere)
150
152 UPROPERTY(Category = "Data Layer|Editor", EditAnywhere, meta = (DisplayName = "Is Initially Loaded"))
154
158
162
164 UPROPERTY()
165 uint32 bIsLocked : 1;
166#endif
167
169 UPROPERTY()
170 FName DataLayerLabel;
171
173 UPROPERTY(Category = "Data Layer|Advanced", EditAnywhere)
174 uint32 bIsRuntime : 1;
175
176 UPROPERTY(Category = "Data Layer|Advanced|Runtime", EditAnywhere, meta = (EditConditionHides, EditCondition = "bIsRuntime"))
177 EDataLayerRuntimeState InitialRuntimeState;
178
179 UPROPERTY(Category = "Data Layer|Editor", EditAnywhere)
180 FColor DebugColor;
181
182 UPROPERTY()
183 TObjectPtr<UDEPRECATED_DataLayer> Parent_DEPRECATED;
184
186 TArray<TObjectPtr<UDEPRECATED_DataLayer>> Children_DEPRECATED;
187};
bool IsRuntime(const UBodySetup *BS)
Definition BodySetup.cpp:381
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DATALAYER_TO_INSTANCE_RUNTIME_CONVERSION_ENABLED
Definition DataLayerInstance.h:14
EDataLayerRuntimeState
Definition DataLayerInstance.h:26
const TCHAR * GetDataLayerRuntimeStateName(EDataLayerRuntimeState State)
Definition DataLayerInstance.h:48
enum UE_DEPRECATED(5.0, "Use EDataLayerRuntimeState instead.") EDataLayerState bool GetDataLayerRuntimeStateFromName(const FString &InStateName, EDataLayerRuntimeState &OutState)
Definition DataLayer.h:24
#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 UFUNCTION(...)
Definition ObjectMacros.h:745
#define GENERATED_UCLASS_BODY(...)
Definition ObjectMacros.h:768
#define UCLASS(...)
Definition ObjectMacros.h:776
#define UENUM(...)
Definition ObjectMacros.h:749
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Engine.Build.cs:7
Definition NameTypes.h:617
Definition UnrealType.h:3087
Definition UnrealType.h:174
Definition Text.h:385
Definition Array.h:670
Definition AssetRegistryState.h:50
Definition DataLayer.h:52
const TArray< TObjectPtr< UDEPRECATED_DataLayer > > & GetChildren() const
Definition DataLayer.h:82
const UDEPRECATED_DataLayer * GetParent() const
Definition DataLayer.h:85
UDEPRECATED_DataLayer * GetParent()
Definition DataLayer.h:86
Definition Object.h:95
@ IgnoreCase
Definition CString.h:26
Definition ActorDataLayer.h:16
Definition Color.h:486
Definition UnrealType.h:6865
Definition ObjectPtr.h:488