UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
LODSyncComponent.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"
7#include "InputCoreTypes.h"
10#include "LODSyncComponent.generated.h"
11
12USTRUCT(BlueprintType)
14{
16
17 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = FLODMappingData)
18 TArray<int32> Mapping;
19
21 TArray<int32> InverseMapping;
22};
23
24UENUM(BlueprintType)
26{
28 Drive,
30 Passive,
32 Disabled,
33};
34
35USTRUCT(BlueprintType)
37{
39
40 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = FComponentSync)
42
43 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = FComponentSync)
44 ESyncOption SyncOption;
45
47 : SyncOption(ESyncOption::Drive)
48 {}
49
51 : Name (InName)
52 , SyncOption(InSyncOption)
53 {}
54};
62UCLASS(Blueprintable, ClassGroup = Component, BlueprintType, meta = (BlueprintSpawnableComponent), MinimalAPI)
64{
66
67 // if -1, it's default and it will calculate the max number of LODs from all sub components
68 // if not, it is a number of LODs (not the max index of LODs)
69 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = LOD, meta=(ScriptName="NumLods;NumLODs"))
70 int32 NumLODs = -1;
71
72 // if -1, it's automatically switching
73 UPROPERTY(EditAnywhere, BlueprintReadWrite, interp, Category = LOD)
74 int32 ForcedLOD = -1;
75
76 // Minimum LOD to use when syncing components
77 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = LOD)
78 int32 MinLOD = 0;
79
85 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = LOD)
86 TArray<FComponentSync> ComponentsToSync;
87
88 // by default, the mapping will be one to one
89 // but if you want custom, add here.
90 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = LOD)
91 TMap<FName, FLODMappingData> CustomLODMapping;
92
94 UFUNCTION(BlueprintCallable, Category = "Components|SkeletalMesh")
95 ENGINE_API FString GetLODSyncDebugText() const;
96
97private:
99 int32 CurrentLOD = 0;
100
101 // num of LODs
103 int32 CurrentNumLODs = 0;
104
105 // component that drives the LOD
108
109 // all the components that ticks
112
113 // BEGIN AActorComponent interface
114 ENGINE_API virtual void OnRegister() override;
115 ENGINE_API virtual void OnUnregister() override;
116 ENGINE_API virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
117 // END AActorComponent interface
118
119public:
120 ENGINE_API void RefreshSyncComponents();
121
128 ENGINE_API void UpdateLOD();
129
130private:
131 int32 GetCustomMappingLOD(const FName& ComponentName, int32 CurrentWorkingLOD) const;
132 int32 GetSyncMappingLOD(const FName& ComponentName, int32 CurrentSourceLOD) const;
133 void InitializeSyncComponents();
134 void UninitializeSyncComponents();
135 const FComponentSync* GetComponentSync(const FName& InName) const;
136};
137
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
ELevelTick
Definition EngineBaseTypes.h:70
ESyncOption
Definition LODSyncComponent.h:26
#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
#define USTRUCT(...)
Definition ObjectMacros.h:746
#define GENERATED_USTRUCT_BODY(...)
Definition ObjectMacros.h:767
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition NameTypes.h:617
Definition Array.h:670
Definition UnrealString.h.inl:34
Definition ActorComponent.h:152
Definition LODSyncComponent.h:64
Definition EngineBaseTypes.h:571
Definition LODSyncComponent.h:37
FComponentSync(const FName &InName, ESyncOption InSyncOption)
Definition LODSyncComponent.h:50
Definition LODSyncComponent.h:14