UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UE::StructUtils Namespace Reference

Namespaces

namespace  Private
 

Classes

class  FArchiveCityHash64
 
class  FHashBuilder
 
struct  FInstancedStructBaseStructQueryParams
 

Functions

uint32 GetStructInstanceCrc32 (const UScriptStruct &ScriptStruct, const uint8 *StructMemory, const uint32 CRC)
 
uint32 GetStructCrc32 (const UScriptStruct &ScriptStruct, const uint8 *StructMemory, const uint32 CRC)
 
template<typename T >
uint32 GetStructCrc32Helper (const T &Struct, const FHashBuilder::EObjectHashingMode ObjectHashingMode, const uint32 CRC)
 
uint32 GetStructCrc32 (const FStructView &StructView, const uint32 CRC)
 
uint32 GetStructCrc32 (const FConstStructView &StructView, const uint32 CRC)
 
uint32 GetStructCrc32 (const FSharedStruct &SharedView, const uint32 CRC)
 
uint32 GetStructCrc32 (const FConstSharedStruct &SharedView, const uint32 CRC)
 
uint32 GetStructInstanceCrc32 (const FStructView &StructView, const uint32 CRC)
 
uint32 GetStructInstanceCrc32 (const FConstStructView &StructView, const uint32 CRC)
 
uint32 GetStructInstanceCrc32 (const FSharedStruct &SharedView, const uint32 CRC)
 
uint32 GetStructInstanceCrc32 (const FConstSharedStruct &SharedView, const uint32 CRC)
 
uint64 GetStructHash64 (const UScriptStruct &ScriptStruct, const uint8 *StructMemory)
 
template<typename T >
uint64 GetStructHash64Helper (const T &Struct)
 
uint64 GetStructHash64 (const FStructView &StructView)
 
uint64 GetStructHash64 (const FConstStructView &StructView)
 
uint64 GetStructHash64 (const FSharedStruct &SharedView)
 
uint64 GetStructHash64 (const FConstSharedStruct &SharedView)
 
template<typename T >
void CheckStructType ()
 
template<typename T >
void CheckWrapperType ()
 
template<typename T >
T & GetStructRef (const UScriptStruct *ScriptStruct, void *StructMemory)
 
template<typename T >
T * GetStructPtr (const UScriptStruct *ScriptStruct, void *StructMemory)
 
template<typename T , typename BaseStructT >
T * GetStructPtr (const UScriptStruct *ScriptStruct, void *StructMemory)
 
template<typename T >
const T & GetStructRef (const UScriptStruct *ScriptStruct, const void *StructMemory)
 
template<typename T >
const T * GetStructPtr (const UScriptStruct *ScriptStruct, const void *StructMemory)
 
template<typename T , typename BaseStructT >
const T * GetStructPtr (const UScriptStruct *ScriptStruct, const void *StructMemory)
 
void CalcMidIndexAndCount (int32 ArrayNum, int32 &InOutIndex, int32 &InOutCount)
 
template<typename T >
autoGetAsUStruct ()
 

Variables

template<typename T >
constexpr bool TIsSharedInstancedOrViewStruct_V
 

Detailed Description

Wrapper structure around an array of Properties to be used as a parameter of a UFunction for querying the base struct of the struct picker in UI. It will be filled with the chain of properties from the owner object to the customizable property, useful if the customizable InstancedStruct is nested in other structs. It also have an optional array index if the struct is nested in an array. TODO: Add support for struct nested in Sets and Maps.

Example:

USTRUCT(BlueprintType) struct FBaseStruct { UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Custom") int IntProperty = 0; };

USTRUCT(BlueprintType) struct FChildStruct1 : public FBaseStruct { UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Custom") float FloatProperty = 0; };

USTRUCT(BlueprintType) struct FChildStruct2 : public FBaseStruct { UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Custom") FString StringProperty; };

USTRUCT(BlueprintType) struct FNestedStruct { UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Custom") int StructToChoose = 0;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Custom", meta = (BaseStructFunction = "GetSettingScriptStruct")) TInstancedStruct<FBaseStruct> MyInstancedStruct; };

UCLASS() class UCustomObject : public UObject { public: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Custom") TArray<FNestedStruct> NestedStructs;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Custom") FNestedStruct NestedStruct2;

if WITH_EDITOR UFUNCTION() UScriptStruct* GetSettingScriptStruct(UE::StructUtils::FInstancedStructBaseStructQueryParams Params) const { int32 Index = -1; if (Params.PropertyChainWithArrayIndex.Num() == 2) { if (Params.PropertyChainWithArrayIndex[0].Property->GetFName() == GET_MEMBER_NAME_CHECKED(UCustomObject, NestedStruct2)) { Index = NestedStruct2.StructToChoose; } } else if (Params.PropertyChainWithArrayIndex.Num() == 3) { if (Params.PropertyChainWithArrayIndex[1].Property->GetFName() == GET_MEMBER_NAME_CHECKED(UCustomObject, NestedStructs)) { const int32 ArrayIndex = Params.PropertyChainWithArrayIndex[1].ArrayIndex; if (ensure(NestedStructs.IsValidIndex(ArrayIndex))) { Index = NestedStructs[ArrayIndex].StructToChoose; } } }

if (Index != -1) { return Index == 0 ? FChildStruct1::StaticStruct() : FChildStruct2::StaticStruct(); } else { return FBaseStruct::StaticStruct(); } } endif // WITH_EDITOR };

Function Documentation

◆ CalcMidIndexAndCount()

void UE::StructUtils::CalcMidIndexAndCount ( int32  ArrayNum,
int32 InOutIndex,
int32 InOutCount 
)
inline

Returns the middle part of an array or view by taking up to the given number of elements from the given position. Based on TArrayView::Mid().

◆ CheckStructType()

template<typename T >
void UE::StructUtils::CheckStructType ( )

◆ CheckWrapperType()

template<typename T >
void UE::StructUtils::CheckWrapperType ( )

◆ GetAsUStruct()

template<typename T >
auto * UE::StructUtils::GetAsUStruct ( )

◆ GetStructCrc32() [1/5]

UE_API uint32 UE::StructUtils::GetStructCrc32 ( const FConstSharedStruct SharedView,
const uint32  CRC 
)

◆ GetStructCrc32() [2/5]

UE_API uint32 UE::StructUtils::GetStructCrc32 ( const FConstStructView StructView,
const uint32  CRC 
)

◆ GetStructCrc32() [3/5]

UE_API uint32 UE::StructUtils::GetStructCrc32 ( const FSharedStruct SharedView,
const uint32  CRC 
)

◆ GetStructCrc32() [4/5]

UE_API uint32 UE::StructUtils::GetStructCrc32 ( const FStructView StructView,
const uint32  CRC 
)

◆ GetStructCrc32() [5/5]

UE_API uint32 UE::StructUtils::GetStructCrc32 ( const UScriptStruct ScriptStruct,
const uint8 StructMemory,
const uint32  CRC = 0 
)

FArchiveCrc32-based struct hashing functions using object path for UObjects. i.e., Objects with same name will produce the same hash

◆ GetStructCrc32Helper()

template<typename T >
uint32 UE::StructUtils::GetStructCrc32Helper ( const T &  Struct,
const FHashBuilder::EObjectHashingMode  ObjectHashingMode,
const uint32  CRC 
)

◆ GetStructHash64() [1/5]

UE_API uint64 UE::StructUtils::GetStructHash64 ( const FConstSharedStruct SharedView)

◆ GetStructHash64() [2/5]

UE_API uint64 UE::StructUtils::GetStructHash64 ( const FConstStructView StructView)

◆ GetStructHash64() [3/5]

UE_API uint64 UE::StructUtils::GetStructHash64 ( const FSharedStruct SharedView)

◆ GetStructHash64() [4/5]

UE_API uint64 UE::StructUtils::GetStructHash64 ( const FStructView StructView)

◆ GetStructHash64() [5/5]

UE_API uint64 UE::StructUtils::GetStructHash64 ( const UScriptStruct ScriptStruct,
const uint8 StructMemory 
)

CityHash64-based struct hashing functions. Note that these are relatively slow due to using either UScriptStruct.GetStructTypeHash (if implemented) or a serialization path.

◆ GetStructHash64Helper()

template<typename T >
uint64 UE::StructUtils::GetStructHash64Helper ( const T &  Struct)

◆ GetStructInstanceCrc32() [1/5]

UE_API uint32 UE::StructUtils::GetStructInstanceCrc32 ( const FConstSharedStruct SharedView,
const uint32  CRC 
)

◆ GetStructInstanceCrc32() [2/5]

UE_API uint32 UE::StructUtils::GetStructInstanceCrc32 ( const FConstStructView StructView,
const uint32  CRC 
)

◆ GetStructInstanceCrc32() [3/5]

UE_API uint32 UE::StructUtils::GetStructInstanceCrc32 ( const FSharedStruct SharedView,
const uint32  CRC 
)

◆ GetStructInstanceCrc32() [4/5]

UE_API uint32 UE::StructUtils::GetStructInstanceCrc32 ( const FStructView StructView,
const uint32  CRC 
)

◆ GetStructInstanceCrc32() [5/5]

UE_API uint32 UE::StructUtils::GetStructInstanceCrc32 ( const UScriptStruct ScriptStruct,
const uint8 StructMemory,
const uint32  CRC = 0 
)

FArchiveCrc32-based struct hashing functions using object key for UObjects. i.e., Generated hash will be unique per object instance

◆ GetStructPtr() [1/4]

template<typename T >
const T * UE::StructUtils::GetStructPtr ( const UScriptStruct ScriptStruct,
const void StructMemory 
)

Returns const pointer to the struct, or nullptr if cast is not valid.

◆ GetStructPtr() [2/4]

template<typename T , typename BaseStructT >
const T * UE::StructUtils::GetStructPtr ( const UScriptStruct ScriptStruct,
const void StructMemory 
)

Returns const pointer to the struct, or nullptr if cast is not valid.

◆ GetStructPtr() [3/4]

template<typename T >
T * UE::StructUtils::GetStructPtr ( const UScriptStruct ScriptStruct,
void StructMemory 
)

Returns pointer to the struct, or nullptr if cast is not valid.

◆ GetStructPtr() [4/4]

template<typename T , typename BaseStructT >
T * UE::StructUtils::GetStructPtr ( const UScriptStruct ScriptStruct,
void StructMemory 
)

Returns pointer to the struct, or nullptr if cast is not valid.

◆ GetStructRef() [1/2]

template<typename T >
const T & UE::StructUtils::GetStructRef ( const UScriptStruct ScriptStruct,
const void StructMemory 
)

Returns const reference to the struct, this assumes that all data is valid.

◆ GetStructRef() [2/2]

template<typename T >
T & UE::StructUtils::GetStructRef ( const UScriptStruct ScriptStruct,
void StructMemory 
)

Returns reference to the struct, this assumes that all data is valid.

Variable Documentation

◆ TIsSharedInstancedOrViewStruct_V

template<typename T >
constexpr bool UE::StructUtils::TIsSharedInstancedOrViewStruct_V
inlineconstexpr
Initial value:
= std::is_same_v<FStructView, T>
|| std::is_same_v<FConstStructView, T>
|| std::is_same_v<FSharedStruct, T>
|| std::is_same_v<FConstSharedStruct, T>
|| std::is_same_v<FInstancedStruct, T>