UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FObjectInitializer Class Reference

#include <UObjectGlobals.h>

Public Member Functions

COREUOBJECT_API FObjectInitializer ()
 
COREUOBJECT_API FObjectInitializer (UObject *InObj, UObject *InObjectArchetype, EObjectInitializerOptions InOptions, struct FObjectInstancingGraph *InInstanceGraph=nullptr)
 
COREUOBJECT_API FObjectInitializer (UObject *InObj, const FStaticConstructObjectParameters &StaticConstructParams)
 
 FObjectInitializer (UObject *InObj, const FStaticConstructObjectParameters &StaticConstructParams, UE::RemoteObject::Serialization::FRemoteObjectConstructionOverrides *RemoteObjectOverides)
 
COREUOBJECT_API ~FObjectInitializer ()
 
UE_FORCEINLINE_HINT UObjectGetArchetype () const
 
UE_FORCEINLINE_HINT UObjectGetObj () const
 
UE_FORCEINLINE_HINT struct FObjectInstancingGraphGetInstancingGraph ()
 
UE_FORCEINLINE_HINT void AddPropertyPostInitCallback (TFunction< void()> &&Callback)
 
COREUOBJECT_API UClassGetClass () const
 
template<class TReturnType >
TReturnTypeCreateDefaultSubobject (UObject *Outer, FName SubobjectName, bool bTransient=false) const
 
template<class TReturnType >
TReturnTypeCreateOptionalDefaultSubobject (UObject *Outer, FName SubobjectName, bool bTransient=false) const
 
template<class TReturnType , class TClassToConstructByDefault >
TReturnTypeCreateDefaultSubobject (UObject *Outer, FName SubobjectName, bool bTransient=false) const
 
template<class TReturnType >
TReturnTypeCreateEditorOnlyDefaultSubobject (UObject *Outer, FName SubobjectName, bool bTransient=false) const
 
COREUOBJECT_API UObjectCreateEditorOnlyDefaultSubobject (UObject *Outer, FName SubobjectName, const UClass *ReturnType, bool bTransient=false) const
 
COREUOBJECT_API UObjectCreateDefaultSubobject (UObject *Outer, FName SubobjectFName, const UClass *ReturnType, const UClass *ClassToCreateByDefault, bool bIsRequired=true, bool bIsTransient=false) const
 
const FObjectInitializerSetDefaultSubobjectClass (FName SubobjectName, const UClass *Class) const
 
template<class T >
const FObjectInitializerSetDefaultSubobjectClass (FName SubobjectName) const
 
const FObjectInitializerDoNotCreateDefaultSubobject (FName SubobjectName) const
 
const FObjectInitializerSetNestedDefaultSubobjectClass (FStringView SubobjectName, const UClass *Class) const
 
const FObjectInitializerSetNestedDefaultSubobjectClass (TArrayView< const FName > SubobjectNames, const UClass *Class) const
 
template<class T >
const FObjectInitializerSetNestedDefaultSubobjectClass (FStringView SubobjectName) const
 
template<class T >
const FObjectInitializerSetNestedDefaultSubobjectClass (TArrayView< const FName > SubobjectNames) const
 
const FObjectInitializerDoNotCreateNestedDefaultSubobject (FStringView SubobjectName) const
 
const FObjectInitializerDoNotCreateNestedDefaultSubobject (TArrayView< const FName > SubobjectNames) const
 
UE_FORCEINLINE_HINT void FinalizeSubobjectClassInitialization ()
 

Static Public Member Functions

static COREUOBJECT_API void AssertIfInConstructor (UObject *Outer, const TCHAR *ErrorMessage)
 
static COREUOBJECT_API FObjectInitializerGet ()
 

Friends

class UObject
 
class FScriptIntegrationObjectHelper
 
struct FStaticConstructObjectParameters
 
template<class T >
void InternalConstructor (const class FObjectInitializer &X)
 

Detailed Description

Internal class to finalize UObject creation (initialize properties) after the real C++ constructor is called.

Constructor & Destructor Documentation

◆ FObjectInitializer() [1/4]

FObjectInitializer::FObjectInitializer ( )

Default Constructor, used when you are using the C++ "new" syntax. UObject::UObject will set the object pointer

◆ FObjectInitializer() [2/4]

FObjectInitializer::FObjectInitializer ( UObject InObj,
UObject InObjectArchetype,
EObjectInitializerOptions  InOptions,
struct FObjectInstancingGraph InInstanceGraph = nullptr 
)

Constructor

Parameters
InObjobject to initialize, from static allocate object, after construction
InObjectArchetypeobject to initialize properties from
InOptionsinitialization options, see EObjectInitializerOptions
InInstanceGraphpassed instance graph

◆ FObjectInitializer() [3/4]

FObjectInitializer::FObjectInitializer ( UObject InObj,
const FStaticConstructObjectParameters StaticConstructParams 
)

Special constructor for static construct object internal that passes along the params block directly

◆ FObjectInitializer() [4/4]

FObjectInitializer::FObjectInitializer ( UObject InObj,
const FStaticConstructObjectParameters StaticConstructParams,
UE::RemoteObject::Serialization::FRemoteObjectConstructionOverrides RemoteObjectOverides 
)
inline

◆ ~FObjectInitializer()

FObjectInitializer::~FObjectInitializer ( )

Destructor for internal class to finalize UObject creation (initialize properties) after the real C++ constructor is called.

Member Function Documentation

◆ AddPropertyPostInitCallback()

UE_FORCEINLINE_HINT void FObjectInitializer::AddPropertyPostInitCallback ( TFunction< void()> &&  Callback)
inline

◆ AssertIfInConstructor()

void FObjectInitializer::AssertIfInConstructor ( UObject Outer,
const TCHAR ErrorMessage 
)
static

Asserts with the specified message if code is executed inside UObject constructor

◆ CreateDefaultSubobject() [1/3]

UObject * FObjectInitializer::CreateDefaultSubobject ( UObject Outer,
FName  SubobjectFName,
const UClass ReturnType,
const UClass ClassToCreateByDefault,
bool  bIsRequired = true,
bool  bIsTransient = false 
) const

Create a component or subobject that will be instanced inside all instances of this class.

Parameters
Outerouter to construct the subobject in
SubobjectNamename of the new component
ReturnTypeclass of return type, all overrides must be of this type
ClassToConstructByDefaultif the derived class has not overridden, create a component of this type
bIsRequiredtrue if the component is required and will always be created even if DoNotCreateDefaultSubobject was specified.
bIsTransienttrue if the component is being assigned to a transient property

◆ CreateDefaultSubobject() [2/3]

template<class TReturnType >
TReturnType * FObjectInitializer::CreateDefaultSubobject ( UObject Outer,
FName  SubobjectName,
bool  bTransient = false 
) const
inline

Create a component or subobject that will be instanced inside all instances of this class.

Parameters
TReturnTypeclass of return type, all overrides must be of this type
Outerouter to construct the subobject in
SubobjectNamename of the new component, this will be the same for all instances of this class
bTransienttrue if the component is being assigned to a transient property

◆ CreateDefaultSubobject() [3/3]

template<class TReturnType , class TClassToConstructByDefault >
TReturnType * FObjectInitializer::CreateDefaultSubobject ( UObject Outer,
FName  SubobjectName,
bool  bTransient = false 
) const
inline

Create a component or subobject, allows creating a child class and returning the parent class.

Parameters
TReturnTypeclass of return type, all overrides must be of this type
TClassToConstructByDefaultclass to construct by default
Outerouter to construct the subobject in
SubobjectNamename of the new component, this will be the same for all instances of this class
bTransienttrue if the component is being assigned to a transient property

◆ CreateEditorOnlyDefaultSubobject() [1/2]

template<class TReturnType >
TReturnType * FObjectInitializer::CreateEditorOnlyDefaultSubobject ( UObject Outer,
FName  SubobjectName,
bool  bTransient = false 
) const
inline

Create a component or subobject only to be used with the editor.

Parameters
TReturnTypeclass of return type, all overrides must be of this type
Outerouter to construct the subobject in
SubobjectNamename of the new component, this will be the same for all instances of this class
bTransienttrue if the component is being assigned to a transient property

◆ CreateEditorOnlyDefaultSubobject() [2/2]

UObject * FObjectInitializer::CreateEditorOnlyDefaultSubobject ( UObject Outer,
FName  SubobjectName,
const UClass ReturnType,
bool  bTransient = false 
) const

Create a component or subobject only to be used with the editor.

Parameters
Outerouter to construct the subobject in
SubobjectNamename of the new component, this will be the same for all instances of this class
ReturnTypetype of the new component
bTransienttrue if the component is being assigned to a transient property

◆ CreateOptionalDefaultSubobject()

template<class TReturnType >
TReturnType * FObjectInitializer::CreateOptionalDefaultSubobject ( UObject Outer,
FName  SubobjectName,
bool  bTransient = false 
) const
inline

Create optional component or subobject. Optional subobjects will not get created. if a derived class specifies DoNotCreateDefaultSubobject with the subobject name.

Parameters
TReturnTypeclass of return type, all overrides must be of this type
Outerouter to construct the subobject in
SubobjectNamename of the new component, this will be the same for all instances of this class
bTransienttrue if the component is being assigned to a transient property

◆ DoNotCreateDefaultSubobject()

const FObjectInitializer & FObjectInitializer::DoNotCreateDefaultSubobject ( FName  SubobjectName) const
inline

Indicates that a base class should not create a component

Parameters
SubobjectNamename of the new component or subobject to not create

◆ DoNotCreateNestedDefaultSubobject() [1/2]

const FObjectInitializer & FObjectInitializer::DoNotCreateNestedDefaultSubobject ( FStringView  SubobjectName) const
inline

Indicates that a subobject should not create a component if created using CreateOptionalDefaultSubobject

Parameters
SubobjectNamename of the new component or subobject to not create

◆ DoNotCreateNestedDefaultSubobject() [2/2]

const FObjectInitializer & FObjectInitializer::DoNotCreateNestedDefaultSubobject ( TArrayView< const FName SubobjectNames) const
inline

Indicates that a subobject should not create a component if created using CreateOptionalDefaultSubobject

Parameters
SubobjectNamename of the new component or subobject to not create

◆ FinalizeSubobjectClassInitialization()

UE_FORCEINLINE_HINT void FObjectInitializer::FinalizeSubobjectClassInitialization ( )
inline

◆ Get()

FObjectInitializer & FObjectInitializer::Get ( )
static

Gets ObjectInitializer for the currently constructed object. Can only be used inside of a constructor of UObject-derived class.

◆ GetArchetype()

UE_FORCEINLINE_HINT UObject * FObjectInitializer::GetArchetype ( ) const
inline

Return the archetype that this object will copy properties from later

◆ GetClass()

UClass * FObjectInitializer::GetClass ( ) const

Return the class of the object that is being constructed

◆ GetInstancingGraph()

UE_FORCEINLINE_HINT struct FObjectInstancingGraph * FObjectInitializer::GetInstancingGraph ( )
inline

◆ GetObj()

UE_FORCEINLINE_HINT UObject * FObjectInitializer::GetObj ( ) const
inline

Return the object that is being constructed

◆ SetDefaultSubobjectClass() [1/2]

template<class T >
const FObjectInitializer & FObjectInitializer::SetDefaultSubobjectClass ( FName  SubobjectName) const
inline

Sets the class to use for a subobject defined in a base class, the class must be a subclass of the class used by the base class.

Parameters
SubobjectNamename of the new component or subobject

◆ SetDefaultSubobjectClass() [2/2]

const FObjectInitializer & FObjectInitializer::SetDefaultSubobjectClass ( FName  SubobjectName,
const UClass Class 
) const
inline

Sets the class to use for a subobject defined in a base class, the class must be a subclass of the class used by the base class.

Parameters
SubobjectNamename of the new component or subobject
ClassThe class to use for the specified subobject or component.

◆ SetNestedDefaultSubobjectClass() [1/4]

template<class T >
const FObjectInitializer & FObjectInitializer::SetNestedDefaultSubobjectClass ( FStringView  SubobjectName) const
inline

Sets the class to use for a subobject defined in a nested subobject, the class must be a subclass of the class used when calling CreateDefaultSubobject.

Parameters
SubobjectNamepath to the new component or subobject

◆ SetNestedDefaultSubobjectClass() [2/4]

const FObjectInitializer & FObjectInitializer::SetNestedDefaultSubobjectClass ( FStringView  SubobjectName,
const UClass Class 
) const
inline

Sets the class to use for a subobject defined in a nested subobject, the class must be a subclass of the class used when calling CreateDefaultSubobject.

Parameters
SubobjectNamepath to the new component or subobject
ClassThe class to use for the specified subobject or component.

◆ SetNestedDefaultSubobjectClass() [3/4]

template<class T >
const FObjectInitializer & FObjectInitializer::SetNestedDefaultSubobjectClass ( TArrayView< const FName SubobjectNames) const
inline

Sets the class to use for a subobject defined in a nested subobject, the class must be a subclass of the class used when calling CreateDefaultSubobject.

Parameters
SubobjectNamepath to the new component or subobject

◆ SetNestedDefaultSubobjectClass() [4/4]

const FObjectInitializer & FObjectInitializer::SetNestedDefaultSubobjectClass ( TArrayView< const FName SubobjectNames,
const UClass Class 
) const
inline

Sets the class to use for a subobject defined in a nested subobject, the class must be a subclass of the class used when calling CreateDefaultSubobject.

Parameters
SubobjectNamepath to the new component or subobject
ClassThe class to use for the specified subobject or component.

Friends And Related Symbol Documentation

◆ FScriptIntegrationObjectHelper

◆ FStaticConstructObjectParameters

◆ InternalConstructor

template<class T >
void InternalConstructor ( const class FObjectInitializer X)
friend

◆ UObject

friend class UObject
friend

The documentation for this class was generated from the following files: