UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ComponentElementData.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
6#include "UObject/Object.h"
8
11
16{
18
25
26 // TypedElementHandles are defer destroyed and can outlive their UObjects, leaving a stale
27 // handle to the Component.
28 // Use ComponentWeak instead to check for validity before use, especially in code that runs during
29 // deferred element handle destruction
30 UE_DEPRECATED(5.7, "Use ComponentWeak")
32
34};
35
37
39{
40
46ENGINE_API UActorComponent* GetComponentFromHandle(const FTypedElementHandle& InHandle, const bool bSilent = false);
47
53ENGINE_API UActorComponent* GetComponentFromHandleChecked(const FTypedElementHandle& InHandle);
54
60template <typename ElementHandleType>
62{
63 TArray<UActorComponent*> Components;
64 Components.Reserve(InHandles.Num());
65
67 {
69 {
70 Components.Add(Component);
71 }
72 }
73
74 return Components;
75}
76
82template <typename ElementHandleType>
95
96} // namespace ComponentElementDataUtil
#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
FString GetTypedElementDebugId(const ElementDataType &InElementData)
Definition TypedElementData.h:35
Definition ArrayView.h:139
Definition Array.h:670
UE_NODEBUG UE_FORCEINLINE_HINT SizeType Add(ElementType &&Item)
Definition Array.h:2696
UE_FORCEINLINE_HINT void Reserve(SizeType Number)
Definition Array.h:3016
Definition ActorComponent.h:152
Definition ComponentElementData.cpp:12
TArray< UActorComponent * > GetComponentsFromHandles(TArrayView< const ElementHandleType > InHandles, const bool bSilent=false)
Definition ComponentElementData.h:61
UActorComponent * GetComponentFromHandle(const FTypedElementHandle &InHandle, const bool bSilent)
Definition ComponentElementData.cpp:14
TArray< UActorComponent * > GetComponentsFromHandlesChecked(TArrayView< const ElementHandleType > InHandles)
Definition ComponentElementData.h:83
UActorComponent * GetComponentFromHandleChecked(const FTypedElementHandle &InHandle)
Definition ComponentElementData.cpp:20
Definition ComponentElementData.h:16
TWeakObjectPtr< UActorComponent > ComponentWeak
Definition ComponentElementData.h:33
ENGINE_API FComponentElementData()
Definition ComponentElementData.cpp:28
UE_DECLARE_TYPED_ELEMENT_DATA_RTTI(FComponentElementData)
ENGINE_API FComponentElementData & operator=(const FComponentElementData &Other)
Definition ComponentElementData.cpp:52
ENGINE_API ~FComponentElementData()
Definition ComponentElementData.cpp:32
UActorComponent * Component
Definition ComponentElementData.h:31
Definition TypedElementHandle.h:18
Definition WeakObjectPtrTemplates.h:25