![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include "UObject/UObjectHash.h"#include "HAL/LowLevelMemTracker.h"#include "Misc/AssertionMacros.h"#include "Misc/TransactionallySafeCriticalSection.h"#include "UObject/Class.h"#include "UObject/GarbageCollectionGlobals.h"#include "UObject/Package.h"#include "UObject/RemoteObjectPrivate.h"#include "UObject/ObjectHandlePrivate.h"#include "UObject/UObjectIterator.h"#include "UObject/ObjectVisibility.h"#include "Templates/Casts.h"#include "Misc/AsciiSet.h"#include "Misc/PackageName.h"#include "Async/ParallelFor.h"#include "HAL/IConsoleManager.h"#include "HAL/LowLevelMemStats.h"#include "ProfilingDebugging/MetadataTrace.h"#include "AutoRTFM.h"#include <atomic>Classes | |
| struct | FSetHashBucket |
| struct | FArrayHashBucket |
| struct | FArrayHashBucket::FObjectsArray |
| struct | THashBucketIterator< T > |
| class | TBucketMap< T, K > |
| struct | TBucketMapLock< T > |
| class | FUObjectHashTables |
| class | FHashTableLock |
| struct | FObjectSearchPath |
Macros | |
| #define | UE_UOBJECT_HASH_USES_ARRAYS 0 |
Typedefs | |
| using | FHashBucketIterator = THashBucketIterator< FSetHashBucket > |
| using | FHashBucket = FSetHashBucket |
Variables | |
| FUObjectArray | GUObjectArray |
| #define UE_UOBJECT_HASH_USES_ARRAYS 0 |
| using FHashBucket = FSetHashBucket |
| FORCEINLINE void AddToClassMap | ( | FUObjectHashTables & | ThreadHash, |
| UObjectBase * | Object | ||
| ) |
Returns true if any instances of the class in question are currently being async loaded.
| ClassToLookFor | The class in question |
| DECLARE_CYCLE_STAT | ( | TEXT("GetObjectsOfClass") | , |
| STAT_Hash_GetObjectsOfClass | , | ||
| STATGROUP_UObjectHash | |||
| ) |
| DECLARE_CYCLE_STAT | ( | TEXT("HashObject") | , |
| STAT_Hash_HashObject | , | ||
| STATGROUP_UObjectHash | |||
| ) |
| DECLARE_CYCLE_STAT | ( | TEXT("UnhashObject") | , |
| STAT_Hash_UnhashObject | , | ||
| STATGROUP_UObjectHash | |||
| ) |
| DEFINE_LOG_CATEGORY_STATIC | ( | LogUObjectHash | , |
| Log | , | ||
| All | |||
| ) |
| DEFINE_STAT | ( | STAT_Hash_NumObjects | ) |
Approximate version of StaticFindObjectFastInternal that may return a false positive - i.e. the object does not exist but the function returns true. Will not return a false negative - i.e. if the object does exist, this function must return true
| InOuter | The direct outer to search within. Must be non-null. |
| ObjectName | The object name to search for. |
| UObjectBase * FindObjectWithOuter | ( | const class UObjectBase * | Outer, |
| const class UClass * | ClassToLookFor = nullptr, |
||
| FName | NameToLookFor = NAME_None |
||
| ) |
Find an objects with a given name and or class within an outer
| Outer | Outer to search for |
| ClassToLookFor | if NULL, ignore this parameter, otherwise require the returned object have this class |
| NameToLookFor | if NAME_None, ignore this parameter, otherwise require the returned object have this name |
| void ForEachObjectOfClass | ( | const UClass * | ClassToLookFor, |
| TFunctionRef< void(UObject *)> | Operation, | ||
| bool | bIncludeDerivedClasses = true, |
||
| EObjectFlags | ExcludeFlags = RF_ClassDefaultObject, |
||
| EInternalObjectFlags | ExclusionInternalFlags = EInternalObjectFlags::None |
||
| ) |
Performs an operation on all objects of the provided class Note that the operation must not modify UObject hash maps so it can not create, rename or destroy UObjects.
| Outer | UObject class to loop over instances of |
| Operation | Function to be called for each object |
| bIncludeDerivedClasses | If true, the results will include objects of child classes as well. |
| AdditionalExcludeFlags | Objects with any of these flags will be excluded from the results. |
| void ForEachObjectOfClasses | ( | TArrayView< const UClass *const > | ClassesToLookFor, |
| TFunctionRef< void(UObject *)> | Operation, | ||
| EObjectFlags | ExcludeFlags = RF_ClassDefaultObject, |
||
| EInternalObjectFlags | ExclusionInternalFlags = EInternalObjectFlags::None |
||
| ) |
Performs an operation on all objects of the provided classes Note that the operation must not modify UObject hash maps so it can not create, rename or destroy UObjects.
| Classes | UObject Classes to loop over instances of |
| Operation | Function to be called for each object |
| bIncludeDerivedClasses | If true, the results will include objects of child classes as well. |
| AdditionalExcludeFlags | Objects with any of these flags will be excluded from the results. |
| FORCEINLINE void ForEachObjectOfClasses_Implementation | ( | FUObjectHashTables & | ThreadHash, |
| TArrayView< const UClass *const > | ClassesToLookFor, | ||
| TFunctionRef< void(UObject *)> | Operation, | ||
| EObjectFlags | ExcludeFlags, | ||
| EInternalObjectFlags | ExclusionInternalFlags | ||
| ) |
| void ForEachObjectWithOuterBreakable | ( | const class UObjectBase * | Outer, |
| TFunctionRef< bool(UObject *)> | Operation, | ||
| bool | bIncludeNestedObjects = true, |
||
| EObjectFlags | ExclusionFlags = RF_NoFlags, |
||
| EInternalObjectFlags | ExclusionInternalFlags = EInternalObjectFlags::None |
||
| ) |
Performs an operation on objects with a given outer, with the possibility to break iteration Note that the operation must not modify the UObject hash maps so it can not create, rename or destroy UObjects.
| Outer | Outer to search for |
| Operation | Function to be called for each object, returning if we want to continue iteration or not |
| bIncludeNestedObjects | If true, then things whose outers directly or indirectly have Outer as an outer are included, these are the nested objects. |
| ExclusionFlags | Specifies flags to use as a filter for which objects to return |
| ExclusiveInternalFlags | Specifies internal flags to use as a filter for which objects to return |
| void ForEachObjectWithPackage | ( | const class UPackage * | Outer, |
| TFunctionRef< bool(UObject *)> | Operation, | ||
| bool | bIncludeNestedObjects = true, |
||
| EObjectFlags | ExclusionFlags = RF_NoFlags, |
||
| EInternalObjectFlags | ExclusionInternalFlags = EInternalObjectFlags::None |
||
| ) |
Performs an operation on all objects found within a given package Note that the operation must not modify UObject hash maps so it can not create, rename or destroy UObjects.
| Package | Package to iterate into |
| Operation | Function to be called for each object, return false to break out of the iteration |
| bIncludeNestedObjects | If true, then things whose outers directly or indirectly have Outer as an outer are included, these are the nested objects. |
| ExclusionFlags | Specifies flags to use as a filter for which objects to return |
| ExclusiveInternalFlags | Specifies internal flags to use as a filter for which objects to return |
Get all base classes and their direct subclasses
| void GetDerivedClasses | ( | const UClass * | ClassToLookFor, |
| TArray< UClass * > & | Results, | ||
| bool | bRecursive = true |
||
| ) |
Returns an array of classes that were derived from the specified class.
| ClassToLookFor | The parent class of the classes to return. |
| Results | An output list of child classes of the specified parent class. |
| bRecursive | If true, the results will include children of the children classes, recursively. Otherwise, only direct decedents will be included. |
| UPackage * GetObjectExternalPackageInternal | ( | const UObjectBase * | Object | ) |
| UPackage * GetObjectExternalPackageThreadSafe | ( | const UObjectBase * | Object | ) |
| void GetObjectsOfClass | ( | const UClass * | ClassToLookFor, |
| TArray< UObject * > & | Results, | ||
| bool | bIncludeDerivedClasses = true, |
||
| EObjectFlags | ExcludeFlags = RF_ClassDefaultObject, |
||
| EInternalObjectFlags | ExclusionInternalFlags = EInternalObjectFlags::None |
||
| ) |
Returns an array of objects of a specific class. Optionally, results can include objects of derived classes as well.
| ClassToLookFor | Class of the objects to return. |
| Results | An output list of objects of the specified class. |
| bIncludeDerivedClasses | If true, the results will include objects of child classes as well. |
| AdditionalExcludeFlags | Objects with any of these flags will be excluded from the results. |
| ExclusiveInternalFlags | Specifies internal flags to use as a filter for which objects to return |
| void GetObjectsWithOuter | ( | const class UObjectBase * | Outer, |
| TArray< UObject * > & | Results, | ||
| bool | bIncludeNestedObjects = true, |
||
| EObjectFlags | ExclusionFlags = RF_NoFlags, |
||
| EInternalObjectFlags | ExclusionInternalFlags = EInternalObjectFlags::None |
||
| ) |
Return all objects with a given outer
| Outer | Outer to search for |
| Results | Returned results |
| bIncludeNestedObjects | If true, then things whose outers directly or indirectly have Outer as an outer are included, these are the nested objects. |
| ExclusionFlags | Specifies flags to use as a filter for which objects to return |
| ExclusiveInternalFlags | Specifies internal flags to use as a filter for which objects to return |
| void GetObjectsWithPackage | ( | const class UPackage * | Outer, |
| TArray< UObject * > & | Results, | ||
| bool | bIncludeNestedObjects = true, |
||
| EObjectFlags | ExclusionFlags = RF_NoFlags, |
||
| EInternalObjectFlags | ExclusionInternalFlags = EInternalObjectFlags::None |
||
| ) |
Returns an array of all objects found within a given package
| Package | Package to search into |
| Results | Array to put the results |
| bIncludeNestedObjects | If true, then things whose outers directly or indirectly have Outer as an outer are included, these are the nested objects. |
| ExclusionFlags | Specifies flags to use as a filter for which objects to return |
| ExclusiveInternalFlags | Specifies internal flags to use as a filter for which objects to return |
| uint64 GetRegisteredClassesVersionNumber | ( | ) |
Get a version number representing the current state of registered classes.
Can be stored and then compared to invalidate external caching of classes hierarchy whenever it changes.
| uint64 GetRegisteredNativeClassesVersionNumber | ( | ) |
Get a version number representing the current state of registered native classes.
Can be stored and then compared to invalidate external caching of native classes hierarchy whenever it changes.
| UE_AUTORTFM_NOAUTORTFM void HashObject | ( | class UObjectBase * | Object | ) |
Add an object to the name hash tables
| Object | Object to add to the hash tables |
| void HashObjectExternalPackage | ( | class UObjectBase * | Object, |
| class UPackage * | Package | ||
| ) |
Assign an external package directly to an object in the hash tables
| Object | Object to assign a package to |
| Package | Package to assign, null will call UnhashObjectExternalPackage |
| LLM_DEFINE_TAG | ( | UObjectHash | , |
| TEXT("UObject hashtables") | |||
| ) |
| void LockUObjectHashTables | ( | ) |
Prevents any other threads from finding/adding UObjects (e.g. while GC is running)
| void LogHashMemoryOverheadStatistics | ( | FOutputDevice & | Ar, |
| const EObjectMemoryOverheadOptions | InOptions | ||
| ) |
Logs out information about the total object hash memory usage for debug purposes
| Ar | the archive to write the log data to |
| InOptions | Logging options |
| void LogHashOuterStatistics | ( | FOutputDevice & | Ar, |
| const bool | bShowHashBucketCollisionInfo | ||
| ) |
Logs out information about the outer object hash for debug purposes
| Ar | the archive to write the log data to |
| bShowHashBucketCollisionInfo | whether to log each bucket's collision count |
| void LogHashStatistics | ( | FOutputDevice & | Ar, |
| const bool | bShowHashBucketCollisionInfo | ||
| ) |
Logs out information about the object hash for debug purposes
| Ar | the archive to write the log data to |
| bShowHashBucketCollisionInfo | whether to log each bucket's collision count |
| void LogHashStatisticsInternal | ( | TBucketMap< int32 > & | Hash, |
| FOutputDevice & | Ar, | ||
| const bool | bShowHashBucketCollisionInfo | ||
| ) |
| void LogHashStatisticsInternal | ( | TMultiMap< int32, uint32 > & | Hash, |
| FOutputDevice & | Ar, | ||
| const bool | bShowHashBucketCollisionInfo | ||
| ) |
| FORCEINLINE void RemoveFromClassMap | ( | FUObjectHashTables & | ThreadHash, |
| UObjectBase * | Object | ||
| ) |
| bool StaticFindAllObjectsFastInternal | ( | TArray< UObject * > & | OutFoundObjects, |
| const UClass * | ObjectClass, | ||
| FName | ObjectName, | ||
| EFindObjectFlags | Flags = EFindObjectFlags::None, |
||
| EObjectFlags | ExcludeFlags = RF_NoFlags, |
||
| EInternalObjectFlags | ExclusiveInternalFlags = EInternalObjectFlags::None |
||
| ) |
Private internal version of StaticFindAllObjectsFast that allows using 0 exclusion flags.
| OutFoundObjects | Array of objects matching the specified search parameters |
| ObjectClass | The to be found object's class |
| ObjectName | The to be found object's name |
| bExactClass | Whether to require an exact match with the passed in class |
| ExcludeFlags | Ignores objects that contain any of the specified exclusive flags |
| ExclusiveInternalFlags | Ignores objects that contain any of the specified internal exclusive flags |
If a class was specified, check that the object is of the correct class
Include (or not) pending kill objects
Ensure that the partial path provided matches the object found
| UObject * StaticFindFirstObjectFastInternal | ( | const UClass * | ObjectClass, |
| FName | ObjectName, | ||
| EFindObjectFlags | Flags = EFindObjectFlags::None, |
||
| EObjectFlags | ExcludeFlag = RF_NoFlags, |
||
| EInternalObjectFlags | ExclusiveInternalFlags = EInternalObjectFlags::None |
||
| ) |
Private internal version of StaticFindFirstObject that allows using 0 exclusion flags.
| ObjectClass | The to be found object's class |
| ObjectName | The to be found object's name |
| bExactClass | Whether to require an exact match with the passed in class |
| ExcludeFlag | Ignores objects that contain any of the specified exclusive flags |
| ExclusiveInternalFlags | Ignores objects that contain any of the specified internal exclusive flags |
If a class was specified, check that the object is of the correct class
Include (or not) pending kill objects
Ensure that the partial path provided matches the object found
| UObject * StaticFindObjectFastExplicit | ( | const UClass * | ObjectClass, |
| FName | ObjectName, | ||
| const FString & | ObjectPathName, | ||
| EFindObjectFlags | Flags, | ||
| EObjectFlags | ExcludeFlags | ||
| ) |
Variation of StaticFindObjectFast that uses explicit path.
| ObjectClass | The to be found object's class |
| ObjectName | The to be found object's class |
| ObjectPathName | Full path name for the object to search for |
| ExactClass | Whether to require an exact match with the passed in class |
| ExclusiveFlags | Ignores objects that contain any of the specified exclusive flags |
| UObject * StaticFindObjectFastExplicitThreadSafe | ( | FUObjectHashTables & | ThreadHash, |
| const UClass * | ObjectClass, | ||
| FName | ObjectName, | ||
| const FString & | ObjectPathName, | ||
| EFindObjectFlags | Flags, | ||
| EObjectFlags | ExcludeFlags | ||
| ) |
If a class was specified, check that the object is of the correct class
Finally check the explicit path
| UObject * StaticFindObjectFastInternal | ( | const UClass * | Class, |
| const UObject * | InOuter, | ||
| FName | InName, | ||
| EFindObjectFlags | Flags = EFindObjectFlags::None, |
||
| EObjectFlags | ExclusiveFlags = RF_NoFlags, |
||
| EInternalObjectFlags | ExclusiveInternalFlags = EInternalObjectFlags::None |
||
| ) |
Private internal version of StaticFindObjectFast that allows using 0 exclusion flags.
| Class | The to be found object's class |
| InOuter | The to be found object's outer |
| InName | The to be found object's class |
| ExactClass | Whether to require an exact match with the passed in class |
| ExclusiveFlags | Ignores objects that contain any of the specified exclusive flags |
| ExclusiveInternalFlags | Ignores objects that contain any of the specified internal exclusive flags |
| UObject * StaticFindObjectFastInternal | ( | FRemoteObjectId | RemoteId, |
| EObjectFlags | InExclusiveFlags = RF_NoFlags, |
||
| EInternalObjectFlags | InExlusiveInternalFlags = EInternalObjectFlags::None |
||
| ) |
Variation of StaticFindObjectFastInternal that uses remote id.
| RemoteId | The to be found object's remote id |
| InExclusiveFlags | Ignores objects that contain any of the specified exclusive flags |
| InExlusiveInternalFlags | Ignores objects that contain any of the specified internal exclusive flags |
| UObject * StaticFindObjectFastInternalThreadSafe | ( | FUObjectHashTables & | ThreadHash, |
| const UClass * | ObjectClass, | ||
| const UObject * | ObjectPackage, | ||
| FName | ObjectName, | ||
| EFindObjectFlags | Flags, | ||
| EObjectFlags | ExcludeFlags, | ||
| EInternalObjectFlags | ExclusiveInternalFlags | ||
| ) |
If a class was specified, check that the object is of the correct class
Include (or not) pending kill objects
If a class was specified, check that the object is of the correct class
Include (or not) pending kill objects
Ensure that the partial path provided matches the object found
| UObject * StaticFindObjectFastInternalThreadSafe | ( | FUObjectHashTables & | ThreadHash, |
| FRemoteObjectId | RemoteId, | ||
| EObjectFlags | InExclusiveFlags, | ||
| EInternalObjectFlags | InExlusiveInternalFlags | ||
| ) |
| UObject * StaticFindObjectInPackageInternal | ( | FUObjectHashTables & | ThreadHash, |
| const UClass * | ObjectClass, | ||
| const UPackage * | ObjectPackage, | ||
| FName | ObjectName, | ||
| EFindObjectFlags | Flags, | ||
| EObjectFlags | ExcludeFlags, | ||
| EInternalObjectFlags | ExclusiveInternalFlags | ||
| ) |
Do not return ourselves (Packages currently have themselves as their package. )
If a class was specified, check that the object is of the correct class
Include (or not) pending kill objects
| UE_AUTORTFM_NOAUTORTFM void UnhashObject | ( | UObjectBase * | Object | ) |
Remove an object to the name hash tables
| Object | Object to remove from the hash tables |
| void UnhashObjectExternalPackage | ( | class UObjectBase * | Object | ) |
Assign an external package directly to an object in the hash tables
| Object | Object to unassign a package from |
| void UnlockUObjectHashTables | ( | ) |
Releases UObject hash tables lock (e.g. after GC has finished running)
| FUObjectArray GUObjectArray |
Global UObject allocator