FStructVariant

A variant type holding an instance of a USTRUCT which acts as a value type (copyable, movable) with comparison and serialization support.

Choose your operating system:

Windows

macOS

Linux

References

Module

CoreUObject

Header

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

Include

#include "UObject/StructVariant.h"

Syntax

struct FStructVariant

Remarks

A variant type holding an instance of a USTRUCT which acts as a value type (copyable, movable) with comparison and serialization support. This can be used as a UPROPERTY to provide a struct type picker and inline editing of the struct instance.

FStructVariant MyStruct;

Constructors

Name Description

Public function

FStructVariant()

Constructor/Destructor.

Public function

FStructVariant

(
    const FStructVariant& InOther
)

Copyable (deep copies the struct instance).

Public function

FStructVariant

(
    FStructVariant&& InOther
)

Movable (steals the struct instance)

Destructors

Name Description

Public function

~FStructVariant()

Functions

Name Description

Public function

void

 

AddStructReferencedObjects

(
    FReferenceCollector& Collector
)

Reference collection.

Public function Const

bool

 

ExportTextItem

(
    FString& ValueStr,
    const FStructVariant& DefaultValue,
    UObject* Parent,
    int32 PortFlags,
    UObject* ExportRootScope
)

Import/ExportText.

Public function

void

 

GetPreloadDependencies

(
    TArray< UObject* >& OutDeps
)

Return all objects that will be Preload()ed when this is serialized at load time.

Public function

StructType &...

 

GetStructInstance()

Get the typed struct instance for this variant, verifying that it is the expected type.

Public function Const

const Struct...

 

GetStructInstance()

Get the typed struct instance for this variant, verifying that it is the expected type.

Public function

void *

 

GetStructInstance

(
    const UScriptStruct* InExpecte...
)

Get the raw struct instance for this variant, optionally verifying that it is the expected type.

Public function Const

const void &...

 

GetStructInstance

(
    const UScriptStruct* InExpecte...
)

Get the raw struct instance for this variant, optionally verifying that it is the expected type.

Public function Const

const UScrip...

 

GetStructType()

Get the struct type of this variant.

Public function Const

bool

 

Identical

(
    const FStructVariant* InOther,
    uint32 PortFlags
)

Public function

bool

 

ImportTextItem

(
    const TCHAR*& Buffer,
    int32 PortFlags,
    UObject* Parent,
    FOutputDevice* ErrorText
)

Public function

bool

 

Serialize

(
    FStructuredArchive::FSlot Slot
)

Serialize the type and instance for this struct.

Public function

void

 

SetStructType()

Set the struct type of this variant and prepare the struct instance for use.

Public function

void

 

SetStructType

(
    const UScriptStruct* InStructT...
)

Set the struct type of this variant and prepare the struct instance for use.

Operators

Name Description

Public function Const

bool

 

operator!=

(
    const FStructVariant& InOther
)

Public function

FStructVaria...

 

operator=

(
    const FStructVariant& InOther
)

Public function

FStructVaria...

 

operator=

(
    FStructVariant&& InOther
)

Public function Const

bool

 

operator==

(
    const FStructVariant& InOther
)

Comparison.