StaticAllocateObject

Create a new instance of an object or replace an existing object.

Windows
MacOS
Linux

References

Module

CoreUObject

Header

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

Include

#include "UObject/UObjectGlobals.h"

Source

/Engine/Source/Runtime/CoreUObject/Private/UObject/UObjectGlobals.cpp

Syntax

UObject * StaticAllocateObject
(
    const UClass * Class,
    UObject * InOuter,
    FName Name,
    EObjectFlags SetFlags,
    EInternalObjectFlags InternalSetFlags,
    bool bCanReuseSubobjects,
    bool * bOutReusedSubobject
)

Remarks

Create a new instance of an object or replace an existing object. If both an Outer and Name are specified, and there is an object already in memory with the same Class, Outer, and Name, the existing object will be destructed, and the new object will be created in its place.

Returns

a pointer to a fully initialized object of the specified class.

Parameters

Parameter

Description

Class

the class of the object to create

InOuter

the object to create this object within (the Outer property for the new object will be set to the value specified here).

Name

the name to give the new object. If no value (NAME_None) is specified, the object will be given a unique name in the form of ClassName_#.

SetFlags

the ObjectFlags to assign to the new object. some flags can affect the behavior of constructing the object.

InternalSetFlags

the InternalObjectFlags to assign to the new object. some flags can affect the behavior of constructing the object.

bCanReuseSubobjects

if set to true, SAO will not attempt to destroy a subobject if it already exists in memory.

bOutReusedSubobject

flag indicating if the object is a subobject that has already been created (in which case further initialization is not necessary).

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss