UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TPersistentObjectPtr< TObjectID > Struct Template Reference

#include <PersistentObjectPtr.h>

Public Types

using ElementType = TObjectID
 

Public Member Functions

UE_FORCEINLINE_HINT TPersistentObjectPtr ()
 
void Reset ()
 
UE_FORCEINLINE_HINT void ResetWeakPtr ()
 
 TPersistentObjectPtr (const TObjectID &InObjectID)
 
void operator= (const TObjectID &InObjectID)
 
void operator= (FObjectPtr Object)
 
UE_FORCEINLINE_HINT void operator= (const UObject *Object)
 
template<typename T >
UE_FORCEINLINE_HINT void operator= (TObjectPtr< T > Object)
 
void operator= (const FWeakObjectPtr &Other)
 
UE_FORCEINLINE_HINT const TObjectIDGetUniqueID () const
 
UE_FORCEINLINE_HINT TObjectIDGetUniqueID ()
 
UObjectGet () const
 
UObjectGet (bool bEvenIfPendingKill) const
 
UE_FORCEINLINE_HINT UObjectoperator* () const
 
UE_FORCEINLINE_HINT UObjectoperator-> () const
 
UE_FORCEINLINE_HINT bool operator== (const TPersistentObjectPtr &Rhs) const
 
UE_FORCEINLINE_HINT bool operator== (TYPE_OF_NULLPTR) const
 
UE_FORCEINLINE_HINT bool operator!= (const TPersistentObjectPtr &Rhs) const
 
UE_FORCEINLINE_HINT bool operator!= (TYPE_OF_NULLPTR) const
 
UE_FORCEINLINE_HINT bool IsPending () const
 
UE_FORCEINLINE_HINT bool IsValid () const
 
UE_FORCEINLINE_HINT bool IsStale () const
 
UE_FORCEINLINE_HINT bool IsNull () const
 

Friends

UE_FORCEINLINE_HINT friend bool operator== (TYPE_OF_NULLPTR, const TPersistentObjectPtr &Rhs)
 
UE_FORCEINLINE_HINT friend bool operator!= (TYPE_OF_NULLPTR, const TPersistentObjectPtr &Rhs)
 
UE_FORCEINLINE_HINT friend uint32 GetTypeHash (const TPersistentObjectPtr &Ptr)
 

Detailed Description

template<class TObjectID>
struct TPersistentObjectPtr< TObjectID >

TPersistentObjectPtr is a template base class for FLazyObjectPtr and FSoftObjectPtr

Member Typedef Documentation

◆ ElementType

template<class TObjectID >
using TPersistentObjectPtr< TObjectID >::ElementType = TObjectID

Constructor & Destructor Documentation

◆ TPersistentObjectPtr() [1/2]

Default constructor, will be null

◆ TPersistentObjectPtr() [2/2]

template<class TObjectID >
TPersistentObjectPtr< TObjectID >::TPersistentObjectPtr ( const TObjectID InObjectID)
inlineexplicit

Construct from a unique object identifier

Member Function Documentation

◆ Get() [1/2]

template<class TObjectID >
UObject * TPersistentObjectPtr< TObjectID >::Get ( ) const
inline

Dereference the pointer, which may cause it to become valid again. Will not try to load pending outside of game thread

Returns
nullptr if this object is gone or the pointer was null, otherwise a valid UObject pointer

◆ Get() [2/2]

template<class TObjectID >
UObject * TPersistentObjectPtr< TObjectID >::Get ( bool  bEvenIfPendingKill) const
inline

Dereference the lazy pointer, which may cause it to become valid again. Will not try to load pending outside of game thread

Parameters
bEvenIfPendingKill,ifthis is true, pendingkill objects are considered valid
Returns
nullptr if this object is gone or the lazy pointer was null, otherwise a valid UObject pointer

◆ GetUniqueID() [1/2]

template<class TObjectID >
UE_FORCEINLINE_HINT TObjectID & TPersistentObjectPtr< TObjectID >::GetUniqueID ( )
inline

Non-const version of the above

◆ GetUniqueID() [2/2]

template<class TObjectID >
UE_FORCEINLINE_HINT const TObjectID & TPersistentObjectPtr< TObjectID >::GetUniqueID ( ) const
inline

Gets the unique object identifier associated with this lazy pointer. Valid even if pointer is not currently valid

Returns
Unique ID for this object, or an invalid FUniqueObjectGuid if this pointer isn't set to anything

◆ IsNull()

template<class TObjectID >
UE_FORCEINLINE_HINT bool TPersistentObjectPtr< TObjectID >::IsNull ( ) const
inline

Test if this can never point to a live UObject

Returns
true if this is explicitly pointing to no object

◆ IsPending()

template<class TObjectID >
UE_FORCEINLINE_HINT bool TPersistentObjectPtr< TObjectID >::IsPending ( ) const
inline

Test if this does not point to a live UObject, but may in the future

Returns
true if this does not point to a real object, but could possibly

◆ IsStale()

template<class TObjectID >
UE_FORCEINLINE_HINT bool TPersistentObjectPtr< TObjectID >::IsStale ( ) const
inline

Slightly different than !IsValid(), returns true if this used to point to a UObject, but doesn't any more and has not been assigned or reset in the mean time.

Returns
true if this used to point at a real object but no longer does.

◆ IsValid()

template<class TObjectID >
UE_FORCEINLINE_HINT bool TPersistentObjectPtr< TObjectID >::IsValid ( ) const
inline

Test if this points to a live UObject

Returns
true if Get() would return a valid non-null pointer

◆ operator!=() [1/2]

Compare pointers for inequality. Only Serial Number matters for the base implementation

◆ operator!=() [2/2]

◆ operator*()

template<class TObjectID >
UE_FORCEINLINE_HINT UObject & TPersistentObjectPtr< TObjectID >::operator* ( ) const
inline

Dereference the pointer

◆ operator->()

template<class TObjectID >
UE_FORCEINLINE_HINT UObject * TPersistentObjectPtr< TObjectID >::operator-> ( ) const
inline

Dereference the pointer

◆ operator=() [1/5]

template<class TObjectID >
void TPersistentObjectPtr< TObjectID >::operator= ( const FWeakObjectPtr Other)
inline

Copy from an existing weak pointer, reserve IDs if required

◆ operator=() [2/5]

template<class TObjectID >
void TPersistentObjectPtr< TObjectID >::operator= ( const TObjectID InObjectID)
inline

Copy from a unique object identifier

◆ operator=() [3/5]

template<class TObjectID >
UE_FORCEINLINE_HINT void TPersistentObjectPtr< TObjectID >::operator= ( const UObject Object)
inline

◆ operator=() [4/5]

template<class TObjectID >
void TPersistentObjectPtr< TObjectID >::operator= ( FObjectPtr  Object)
inline

Copy from an object pointer

◆ operator=() [5/5]

template<class TObjectID >
template<typename T >
UE_FORCEINLINE_HINT void TPersistentObjectPtr< TObjectID >::operator= ( TObjectPtr< T >  Object)
inline

◆ operator==() [1/2]

template<class TObjectID >
UE_FORCEINLINE_HINT bool TPersistentObjectPtr< TObjectID >::operator== ( const TPersistentObjectPtr< TObjectID > &  Rhs) const
inline

Compare pointers for equality. Only Serial Number matters for the base implementation

◆ operator==() [2/2]

template<class TObjectID >
UE_FORCEINLINE_HINT bool TPersistentObjectPtr< TObjectID >::operator== ( TYPE_OF_NULLPTR  ) const
inline

◆ Reset()

template<class TObjectID >
void TPersistentObjectPtr< TObjectID >::Reset ( )
inline

Reset the lazy pointer back to the null state

◆ ResetWeakPtr()

template<class TObjectID >
UE_FORCEINLINE_HINT void TPersistentObjectPtr< TObjectID >::ResetWeakPtr ( )
inline

Resets the weak ptr only, call this when ObjectId may change

Friends And Related Symbol Documentation

◆ GetTypeHash

template<class TObjectID >
UE_FORCEINLINE_HINT friend uint32 GetTypeHash ( const TPersistentObjectPtr< TObjectID > &  Ptr)
friend

Hash function

◆ operator!=

template<class TObjectID >
UE_FORCEINLINE_HINT friend bool operator!= ( TYPE_OF_NULLPTR  ,
const TPersistentObjectPtr< TObjectID > &  Rhs 
)
friend

◆ operator==

template<class TObjectID >
UE_FORCEINLINE_HINT friend bool operator== ( TYPE_OF_NULLPTR  ,
const TPersistentObjectPtr< TObjectID > &  Rhs 
)
friend

The documentation for this struct was generated from the following file: