UStruct

Base class for all [UObject](API\Runtime\CoreUObject\UObject\UObject) types that contain fields.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

CoreUObject

Header

/Engine/Source/Runtime/CoreUObject/Public/UObject/Class.h

Include

#include "UObject/Class.h"

Syntax

class UStruct :
    public UField,
    private FStructBaseChain

Remarks

Base class for all UObject types that contain fields.

Variables

Name Description

Public variable

UField *

 

Children

Pointer to start of linked list of child fields

Public variable

UProperty *

 

DestructorLink

In memory only: Linked list of properties requiring destruction.

Public variable

int32

 

MinAlignment

Alignment of structure in memory, structure will be at least this large

Public variable

UProperty *

 

PostConstructLink

In memory only: Linked list of properties requiring post constructor initialization

Public variable

int32

 

PropertiesSize

Total size of all UProperties, the allocated structure may be larger due to alignment

Public variable

UProperty *

 

PropertyLink

In memory only: Linked list of properties from most-derived to base

Public variable

UProperty *

 

RefLink

In memory only: Linked list of object reference properties from most-derived to base

Public variable

TArray< uint8 >

 

Script

Script bytecode associated with this object

Public variable

TArray< UObject * >

 

ScriptObjectReferences

Array of object references embedded in script code.

Constructors

Name Description

Public function

UStruct

(
    const FObjectInitializer& ObjectInitializer
)

Public function

UStruct

(
    FVTableHelper& Helper
)

DO NOT USE. This constructor is for internal usage only for hot-reload purposes.

Public function

UStruct

(
    UStruct* InSuperStruct,
    SIZE_T ParamsSize,
    SIZE_T Alignment
)

Public function

UStruct

(
    EStaticConstructor,
    int32 InSize,
    int32 InAlignment,
    EObjectFlags InFlags
)

Constructors.

Public function

UStruct

(
    const FObjectInitializer& ObjectInitializer,
    UStruct* InSuperStruct,
    SIZE_T ParamsSize,
    SIZE_T Alignment
)

Functions

Name Description

Public function Static

void

 

__DefaultConstructor

(
    const FObjectInitializer& X
)

Public function Static

UObject *

 

__VTableCtorCaller

(
    FVTableHelper& Helper
)

Public function Static

void

 

AddReferencedObjects

(
    UObject* InThis,
    FReferenceCollector& Collector
)

Protected function Virtual Const

bool

 

ArePropertyGuidsAvailable()

Returns if we have access to property guids

Public function Virtual Const

UProperty *

 

CustomFindProperty

(
    const FName InName
)

Look up a property by an alternate name if it was not found in the first search, this is overridden for user structs

Public function Virtual Const

void

 

DestroyStruct

(
    void* Dest,
    int32 ArrayDim
)

Destroy a struct in memory.

Public function Const

UProperty *

 

FindPropertyByName

(
    FName InName
)

Searches property link chain for a property with the specified name

Protected function Virtual Const

FGuid

 

FindPropertyGuidFromName

(
    const FName InName
)

Find property guid

Protected function Virtual Const

FName

 

FindPropertyNameFromGuid

(
    const FGuid& PropertyGuid
)

Returns the property name from the guid

Public function Virtual Const

FString

 

GetAuthoredNameForField

(
    const UField* Field
)

Returns a human readable string for a given field, overridden for user defined structs

Public function Const

bool

 

GetBoolMetaDataHierarchical

(
    const FName& Key
)

Try and find boolean metadata with the given key.

Public function Virtual Const

UStruct *

 

GetInheritanceSuper()

Returns the structure used for inheritance, may be changed by child types

Public function Const

int32

 

GetMinAlignment()

Alignment of structure in memory, structure will be at least this large

Public function Virtual Const

const TCHAR *

 

GetPrefixCPP()

Returns the struct/ class prefix used for the C++ declaration of this struct/ class.

Public function Const

int32

 

GetPropertiesSize()

Total size of all UProperties, the allocated structure may be larger due to alignment

Public function Const

bool

 

GetStringMetaDataHierarchical

(
    const FName& Key,
    FString* OutValue
)

Try and find string metadata with the given key.

Public function Const

int32

 

GetStructureSize()

Returns actual allocated size of structure in memory

Public function Const

UStruct *

 

GetSuperStruct()

Struct this inherits from, may be null

Public function Const

const UStruct *

 

HasMetaDataHierarchical

(
    const FName& Key
)

Determines if the struct or any of its super structs has any metadata associated with the provided key

Public function Virtual Const

void

 

InitializeStruct

(
    void* Dest,
    int32 ArrayDim
)

Initialize a struct over uninitialized memory.

Public function

void

 

InstanceSubobjectTemplates

(
    void* Data,
    void const* DefaultData,
    UStruct* DefaultStruct,
    UObject* Owner,
    FObjectInstancingGraph* InstanceGraph
)

Creates new copies of components

Public function Const

bool

 

IsChildOf

(
    const UStruct* SomeBase
)

Returns true if this struct either is SomeBase, or is a child of SomeBase.

Public function Const

bool

 

IsChildOf()

Returns true if this struct either is class T, or is a child of class T.

Public function Virtual

void

 

Link

(
    FArchive& Ar,
    bool bRelinkExistingProperties
)

Creates the field/property links and gets structure ready for use at runtime

Public function Virtual Const

void

 

SerializeBin

(
    FStructuredArchive::FSlot Slot,
    void* Data
)

Serializes struct properties, does not handle defaults

Public function Virtual Const

void

 

SerializeBin

(
    FArchive& Ar,
    void* Data
)

Serializes struct properties, does not handle defaults

Public function Const

void

 

SerializeBinEx

(
    FStructuredArchive::FSlot Slot,
    void* Data,
    void const* DefaultData,
    UStruct* DefaultStruct
)

Serializes the class properties that reside in Data if they differ from the corresponding values in DefaultData

Public function Virtual

EExprToken

 

SerializeExpr

(
    int32& iCode,
    FArchive& Ar
)

Serialize an expression to an archive. Returns expression token

Public function Virtual Const

void

 

SerializeTaggedProperties

(
    FArchive& Ar,
    uint8* Data,
    UStruct* DefaultsStruct,
    uint8* Defaults,
    const UObject* BreakRecursionIfFullyLoad
)

Serializes list of properties, using property tags to handle mismatches

Public function Virtual Const

void

 

SerializeTaggedProperties

(
    FStructuredArchive::FSlot Slot,
    uint8* Data,
    UStruct* DefaultsStruct,
    uint8* Defaults,
    const UObject* BreakRecursionIfFullyLoad
)

Serializes list of properties, using property tags to handle mismatches

Public function

void

 

SetPropertiesSize

(
    int32 NewSize
)

Modifies the property size after it's been recomputed

Public function Virtual

void

 

SetSuperStruct

(
    UStruct* NewSuperStruct
)

Sets the super struct pointer and updates hash information as necessary.

Public function Static

UClass *

 

StaticClass()

Returns a UClass object representing this class at runtime

Public function Static

EClassCastFlags

 

StaticClassCastFlags()

Returns the static cast flags for this class

Public function

void

 

StaticLink

(
    bool bRelinkExistingProperties
)

Static wrapper for Link, using a dummy archive

Public function Static

const TCHAR *

 

StaticPackage()

Returns the package this class belongs in

Public function Static

void

 

StaticRegisterNativesUStruct()

Overridden from UField

Name Description

Public function Virtual

void

 

AddCppProperty

(
    UProperty* Property
)

Overridden from UObject

Name Description

Public function Virtual

void

 

FinishDestroy()

Called to finish destroying the object.

Public function Virtual

void

 

GetPreloadDependencies

(
    TArray< UObject* >& OutDeps
)

Called during cooking.

Public function Virtual

void

 

Serialize

(
    FStructuredArchive::FRecord Record
)

Handles reading, writing, and reference collecting using FArchive.

Public function Virtual

void

 

Serialize

(
    FArchive& Ar
)

Handles reading, writing, and reference collecting using FArchive.

Public function Virtual

void

 

TagSubobjects

(
    EObjectFlags NewFlags
)

Tags objects that are part of the same asset with the specified object flag, used for GC checking

Overridden from UObjectBase

Name Description

Public function Virtual

void

 

RegisterDependencies()

Force any base classes to be registered first, then call BaseRegister

Operators

Name Description

Public function

void *

 

operator new

(
    const size_t InSize,
    EInternal InInternalOnly,
    UObject* InOuter,
    FName InName,
    EObjectFlags InSetFlags
)

For internal use only; use StaticConstructObject() to create new objects.

Public function

void *

 

operator new

(
    const size_t InSize,
    EInternal* InMem
)

For internal use only; use StaticConstructObject() to create new objects.

Typedefs

Name

Description

Super

Typedef for the base class (UField)

ThisClass

Typedef for UStruct.

Constants

Name

Description

StaticClassFlags

Bitwise union of EClassFlags pertaining to this class.

Deprecated Functions

Name Description

Public function Virtual Const

FString

 

PropertyNameToDisplayName

(
    FName InName
)

Replace with GetAuthoredNameForField or UField::GetAuthoredName

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback