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

#include <UObjectBase.h>

+ Inheritance diagram for UObjectBase:

Public Member Functions

COREUOBJECT_API UObjectBase (UClass *InClass, EObjectFlags InFlags, EInternalObjectFlags InInternalFlags, UObject *InOuter, FName InName, int32 InInternalIndex=-1, int32 InSerialNumber=0, FRemoteObjectId InRemoteId=FRemoteObjectId())
 
virtual COREUOBJECT_API ~UObjectBase ()
 
COREUOBJECT_API bool IsValidLowLevel () const
 
COREUOBJECT_API bool IsValidLowLevelFast (bool bRecursive=true) const
 
FORCEINLINE uint32 GetUniqueID () const
 
FORCEINLINE UClassGetClass () const
 
FORCEINLINE UObjectGetOuter () const
 
FORCEINLINE FName GetFName () const
 
virtual COREUOBJECT_API FName GetFNameForStatID () const
 
COREUOBJECT_API UPackageGetExternalPackage () const
 
COREUOBJECT_API void SetExternalPackage (UPackage *InPackage)
 
COREUOBJECT_API UPackageGetExternalPackageInternal () const
 
COREUOBJECT_API void MarkAsReachable () const
 
COREUOBJECT_API void AddRef () const
 
COREUOBJECT_API void ReleaseRef () const
 
FORCEINLINE EObjectFlags GetFlags () const
 
FORCENOINLINE void AtomicallySetFlags (EObjectFlags FlagsToAdd)
 
FORCENOINLINE void AtomicallyClearFlags (EObjectFlags FlagsToClear)
 

Static Public Member Functions

static COREUOBJECT_API FString RemoveClassPrefix (const TCHAR *ClassName)
 
static void PrefetchClass (UObject *Object)
 
static void PrefetchOuter (UObject *Object)
 

Protected Member Functions

 UObjectBase ()
 
COREUOBJECT_API UObjectBase (EObjectFlags InFlags)
 
COREUOBJECT_API void LowLevelRename (FName NewName, UObject *NewOuter=NULL)
 
virtual void RegisterDependencies ()
 
COREUOBJECT_API void Register (class UClass *(*StaticClassFn)(), const TCHAR *PackageName, const TCHAR *Name)
 
COREUOBJECT_API void Register (const TCHAR *PackageName, const TCHAR *Name)
 
virtual COREUOBJECT_API void DeferredRegister (UClass *UClassStaticClass, const TCHAR *PackageName, const TCHAR *Name)
 
FORCEINLINE void SetFlagsTo (EObjectFlags NewFlags)
 

Friends

class UObjectBaseUtility
 
struct Z_Construct_UClass_UObject_Statics
 
class FUObjectArray
 
class FUObjectAllocator
 
struct FInternalUObjectBaseUtilityIsValidFlagsChecker
 
struct UE::CoreUObject::Private::FObjectHandleUtils
 
class FBlueprintCompileReinstancer
 
class FVerseObjectClassReplacer
 
class FContextObjectManager
 
class FDeferredRegistry
 
class FCompiledInObjectRegistry
 
COREUOBJECT_API void UObjectForceRegistration (UObjectBase *Object, bool bCheckForModuleRelease)
 
COREUOBJECT_API void InitializePrivateStaticClass (class UClass *(*TClass_StaticClassFn)(), class UClass *TClass_Super_StaticClass, class UClass *TClass_PrivateStaticClass, class UClass *TClass_WithinClass_StaticClass, const TCHAR *PackageName, const TCHAR *Name)
 
COREUOBJECT_API UObjectStaticAllocateObject (const UClass *, UObject *, FName, EObjectFlags, EInternalObjectFlags, bool, bool *, UPackage *, int32, FRemoteObjectId, class FGCReconstructionGuard *)
 
void AddToClassMap (class FUObjectHashTables &ThreadHash, UObjectBase *Object)
 
void RemoveFromClassMap (class FUObjectHashTables &ThreadHash, UObjectBase *Object)
 

Detailed Description

Low level implementation of UObject, should not be used directly in game code

Constructor & Destructor Documentation

◆ UObjectBase() [1/3]

UObjectBase::UObjectBase ( )
inlineprotected

◆ UObjectBase() [2/3]

UObjectBase::UObjectBase ( EObjectFlags  InFlags)
protected

Constructor used for bootstrapping

Parameters
InFlagsRF_Flags to assign

Constructor used for bootstrapping

Parameters
InClasspossibly NULL, this gives the class of the new object, if known at this time
InFlagsRF_Flags to assign

◆ UObjectBase() [3/3]

UObjectBase::UObjectBase ( UClass InClass,
EObjectFlags  InFlags,
EInternalObjectFlags  InInternalFlags,
UObject InOuter,
FName  InName,
int32  InInternalIndex = -1,
int32  InSerialNumber = 0,
FRemoteObjectId  InRemoteId = FRemoteObjectId() 
)

Constructor used by StaticAllocateObject

Parameters
InClassnon NULL, this gives the class of the new object, if known at this time
InFlagsRF_Flags to assign
InInternalFlagsEInternalObjectFlags to assign
InOuterouter for this object
InNamename of the new object
InInternalIndexinternal index to use (if already allocated), negative value means allocate a new index
InSerialNumberserial number to re-use (if already allocated)

Constructor used by StaticAllocateObject

Parameters
InClassnon NULL, this gives the class of the new object, if known at this time
InFlagsRF_Flags to assign
InOuterouter for this object
InNamename of the new object
InObjectArchetypearchetype to assign

◆ ~UObjectBase()

UObjectBase::~UObjectBase ( )
virtual

Final destructor, removes the object from the object array, and indirectly, from any annotations

Member Function Documentation

◆ AddRef()

void UObjectBase::AddRef ( ) const

Increments ref-count on the object. Should always be paired with RAII (i.e. TStrongObjectPtr).

◆ AtomicallyClearFlags()

FORCENOINLINE void UObjectBase::AtomicallyClearFlags ( EObjectFlags  FlagsToClear)
inline

Atomically clears the specified flags.

◆ AtomicallySetFlags()

FORCENOINLINE void UObjectBase::AtomicallySetFlags ( EObjectFlags  FlagsToAdd)
inline

Atomically adds the specified flags.

◆ DeferredRegister()

void UObjectBase::DeferredRegister ( UClass UClassStaticClass,
const TCHAR PackageName,
const TCHAR InName 
)
protectedvirtual

Convert a boot-strap registered class into a real one, add to uobject array, etc

Parameters
UClassStaticClassNow that it is known, fill in UClass::StaticClass() as the class

Convert a boot-strap registered class into a real one, add to uobject array, etc

Parameters
UClassStaticClassNow that it is known, fill in ClassPrivate. This is usually UClass::StaticClass.

Reimplemented in UClass.

◆ GetClass()

FORCEINLINE UClass * UObjectBase::GetClass ( ) const
inline

Returns the UClass that defines the fields of this object

◆ GetExternalPackage()

UPackage * UObjectBase::GetExternalPackage ( ) const

Returns the external UPackage associated with this object, if any

◆ GetExternalPackageInternal()

UPackage * UObjectBase::GetExternalPackageInternal ( ) const

Returns the external UPackage for this object, if any, NOT THREAD SAFE, used by internal gc reference collecting.

◆ GetFlags()

FORCEINLINE EObjectFlags UObjectBase::GetFlags ( ) const
inline

Retrieve the object flags directly

Returns
Flags for this object

◆ GetFName()

FORCEINLINE FName UObjectBase::GetFName ( ) const
inline

Returns the logical name of this object

◆ GetFNameForStatID()

FName UObjectBase::GetFNameForStatID ( ) const
virtual

Overridable method to return a logical name for identification in stats.

◆ GetOuter()

FORCEINLINE UObject * UObjectBase::GetOuter ( ) const
inline

Returns the UObject this object resides in

◆ GetUniqueID()

FORCEINLINE uint32 UObjectBase::GetUniqueID ( ) const
inline

Returns the unique ID of the object...these are reused so it is only unique while the object is alive. Useful as a tag.

◆ IsValidLowLevel()

bool UObjectBase::IsValidLowLevel ( ) const

Checks to see if the object appears to be valid

Returns
true if this appears to be a valid object

◆ IsValidLowLevelFast()

bool UObjectBase::IsValidLowLevelFast ( bool  bRecursive = true) const

Faster version of IsValidLowLevel. Checks to see if the object appears to be valid by checking pointers and their alignment. Name and InternalIndex checks are less accurate than IsValidLowLevel.

Parameters
bRecursivetrue if the Class pointer should be checked with IsValidLowLevelFast
Returns
true if this appears to be a valid object

◆ LowLevelRename()

void UObjectBase::LowLevelRename ( FName  NewName,
UObject NewOuter = NULL 
)
protected

Just change the FName and Outer and rehash into name hash tables. For use by higher level rename functions.

Parameters
NewNamenew name for this object
NewOuternew outer for this object, if NULL, outer will be unchanged

◆ MarkAsReachable()

UE_AUTORTFM_ALWAYS_OPEN void UObjectBase::MarkAsReachable ( ) const

Marks the object as Reachable if it's currently marked as MaybeUnreachable by incremental GC.

◆ PrefetchClass()

static void UObjectBase::PrefetchClass ( UObject Object)
inlinestatic

◆ PrefetchOuter()

static void UObjectBase::PrefetchOuter ( UObject Object)
inlinestatic

◆ Register() [1/2]

void UObjectBase::Register ( class UClass *(*)()  StaticClassFn,
const TCHAR PackageName,
const TCHAR Name 
)
protected

Enqueue the registration for this object.

◆ Register() [2/2]

void UObjectBase::Register ( const TCHAR PackageName,
const TCHAR InName 
)
protected

Enqueue the registration for this object.

◆ RegisterDependencies()

virtual void UObjectBase::RegisterDependencies ( )
inlineprotectedvirtual

Force any base classes to be registered first

Reimplemented in UStruct.

◆ ReleaseRef()

void UObjectBase::ReleaseRef ( ) const

Release ref-count on the object.

◆ RemoveClassPrefix()

FString UObjectBase::RemoveClassPrefix ( const TCHAR ClassName)
static

Removes the class prefix from the given string

Removes prefix from the native class name

◆ SetExternalPackage()

void UObjectBase::SetExternalPackage ( UPackage InPackage)

Associate an external package directly to this object.

◆ SetFlagsTo()

FORCEINLINE void UObjectBase::SetFlagsTo ( EObjectFlags  NewFlags)
inlineprotected

Set the object flags directly

Friends And Related Symbol Documentation

◆ AddToClassMap

void AddToClassMap ( class FUObjectHashTables ThreadHash,
UObjectBase Object 
)
friend

◆ FBlueprintCompileReinstancer

friend class FBlueprintCompileReinstancer
friend

◆ FCompiledInObjectRegistry

friend class FCompiledInObjectRegistry
friend

◆ FContextObjectManager

friend class FContextObjectManager
friend

◆ FDeferredRegistry

friend class FDeferredRegistry
friend

◆ FInternalUObjectBaseUtilityIsValidFlagsChecker

◆ FUObjectAllocator

friend class FUObjectAllocator
friend

◆ FUObjectArray

friend class FUObjectArray
friend

◆ FVerseObjectClassReplacer

friend class FVerseObjectClassReplacer
friend

◆ InitializePrivateStaticClass

COREUOBJECT_API void InitializePrivateStaticClass ( class UClass *(*)()  TClass_StaticClassFn,
class UClass TClass_Super_StaticClass,
class UClass TClass_PrivateStaticClass,
class UClass TClass_WithinClass_StaticClass,
const TCHAR PackageName,
const TCHAR Name 
)
friend

Shared function called from the various InitializePrivateStaticClass functions generated my the IMPLEMENT_CLASS macro.

◆ RemoveFromClassMap

void RemoveFromClassMap ( class FUObjectHashTables ThreadHash,
UObjectBase Object 
)
friend

◆ StaticAllocateObject

COREUOBJECT_API UObject * StaticAllocateObject ( const UClass ,
UObject ,
FName  ,
EObjectFlags  ,
EInternalObjectFlags  ,
bool  ,
bool ,
UPackage ,
int32  ,
FRemoteObjectId  ,
class FGCReconstructionGuard  
)
friend

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.

Parameters
Classthe class of the object to create
InOuterthe object to create this object within (the Outer property for the new object will be set to the value specified here).
Namethe 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_#.
SetFlagsthe ObjectFlags to assign to the new object. some flags can affect the behavior of constructing the object.
InternalSetFlagsthe InternalObjectFlags to assign to the new object. some flags can affect the behavior of constructing the object.
bCanReuseSubobjectsif set to true, SAO will not attempt to destroy a subobject if it already exists in memory.
bOutReusedSubobjectflag indicating if the object is a subobject that has already been created (in which case further initialization is not necessary).
ExternalPackageExternal Package assigned to the allocated object, if any
RemoteIdGlobally unique id for this object
GCGuardSpecial synchronization object that prevents GC from running when reconstructing an object on top of existing one
Returns
a pointer to a fully initialized object of the specified class.

◆ UE::CoreUObject::Private::FObjectHandleUtils

◆ UObjectBaseUtility

friend class UObjectBaseUtility
friend

◆ UObjectForceRegistration

COREUOBJECT_API void UObjectForceRegistration ( UObjectBase Object,
bool  bCheckForModuleRelease 
)
friend

Force a pending registrant to register now instead of in the natural order

◆ Z_Construct_UClass_UObject_Statics

friend struct Z_Construct_UClass_UObject_Statics
friend

Member Data Documentation

◆ NamePrivate

FNameAndObjectHashIndex UObjectBase::NamePrivate = {}

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