Navigation
API > API/Runtime > API/Runtime/Core
TWeakObjectPtr is the templated version of the generic FWeakObjectPtr
| Name | TWeakObjectPtr |
| Type | struct |
| Header File | /Engine/Source/Runtime/Core/Public/UObject/WeakObjectPtrTemplates.h |
| Include Path | #include "UObject/WeakObjectPtrTemplates.h" |
Syntax
template<class T, class TWeakObjectPtrBase>
struct TWeakObjectPtr
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
| UObject/WeakObjectPtrTemplates.h | |||
TWeakObjectPtr
(
const TWeakObjectPtr& |
UObject/WeakObjectPtrTemplates.h | ||
TWeakObjectPtr
(
TYPE_OF_NULLPTR |
Construct from a null pointer | UObject/WeakObjectPtrTemplates.h | |
TWeakObjectPtr
(
U Object |
Construct from an object pointer | UObject/WeakObjectPtrTemplates.h | |
TWeakObjectPtr
(
const TWeakObjectPtr< OtherT, TWeakObjectPtrBase >& Other |
Construct from another weak pointer of another type, intended for derived-to-base conversions | UObject/WeakObjectPtrTemplates.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
~TWeakObjectPtr() |
UObject/WeakObjectPtrTemplates.h |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| ElementType | T | Although templated, these parameters are not intended to be anything other than the default, and are only templates for module organization reasons. | UObject/WeakObjectPtrTemplates.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| WeakPtr | TWeakObjectPtrBase | UObject/WeakObjectPtrTemplates.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
T * Get
(
bool bEvenIfPendingKill |
Dereference the weak pointer | UObject/WeakObjectPtrTemplates.h | |
T * Get () |
Dereference the weak pointer. This is an optimized version implying bEvenIfPendingKill=false. | UObject/WeakObjectPtrTemplates.h | |
T * GetEvenIfUnreachable () |
Deferences the weak pointer even if its marked RF_Unreachable. | UObject/WeakObjectPtrTemplates.h | |
uint32 GetWeakPtrTypeHash() |
Hash function. | UObject/WeakObjectPtrTemplates.h | |
bool HasSameIndexAndSerialNumber
(
const TWeakObjectPtr< OtherT, TWeakObjectPtrBase >& Other |
Returns true if two weak pointers were originally set to the same object, even if they are now stale | UObject/WeakObjectPtrTemplates.h | |
bool HasSameIndexAndSerialNumber
(
const TWeakObjectPtr& Other |
Returns true if two weak pointers were originally set to the same object, even if they are now stale | UObject/WeakObjectPtrTemplates.h | |
bool IsExplicitlyNull () |
Returns true if this pointer was explicitly assigned to null, was reset, or was never initialized. | UObject/WeakObjectPtrTemplates.h | |
bool IsRemote() |
UObject/WeakObjectPtrTemplates.h | ||
bool IsStale
(
bool bIncludingIfPendingKill, |
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. | UObject/WeakObjectPtrTemplates.h | |
bool IsValid () |
Test if this points to a live UObject. | UObject/WeakObjectPtrTemplates.h | |
bool IsValid
(
bool bEvenIfPendingKill, |
Test if this points to a live UObject. | UObject/WeakObjectPtrTemplates.h | |
TStrongObjectPtr< T > Pin
(
bool bEvenIfPendingKill |
Pin the weak pointer and get a strongptr. | UObject/WeakObjectPtrTemplates.h | |
TStrongObjectPtr< T > Pin () |
Pin the weak pointer as a strong ptr. | UObject/WeakObjectPtrTemplates.h | |
void Reset() |
Reset the weak pointer back to the null state | UObject/WeakObjectPtrTemplates.h | |
void Serialize
(
FArchive& Ar |
Weak object pointer serialization, this forwards to FArchive::operator<<(struct FWeakObjectPtr&) or an override | UObject/WeakObjectPtrTemplates.h | |
TStrongObjectPtr< T > TryPin
(
bool& bOutPinValid |
Pin the weak pointer as a strong ptr. | UObject/WeakObjectPtrTemplates.h | |
TStrongObjectPtr< T > TryPin
(
bool& bOutPinValid, |
Pin the weak pointer and get a strongptr. | UObject/WeakObjectPtrTemplates.h | |
bool UEOpEquals
(
const RhsT* Rhs |
UObject/WeakObjectPtrTemplates.h | ||
bool UEOpEquals
(
const TWeakObjectPtr< RhsT, TWeakObjectPtrBase >& Rhs |
Compare weak pointers for equality. | UObject/WeakObjectPtrTemplates.h | |
bool UEOpEquals
(
TYPE_OF_NULLPTR |
UObject/WeakObjectPtrTemplates.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
operator bool() |
This is explicitly not added to avoid resolving weak pointers too often - use Get() once in a function. | UObject/WeakObjectPtrTemplates.h | |
operator TWeakObjectPtrBase() |
Cast to the underlying generic FWeakObjectPtr type | UObject/WeakObjectPtrTemplates.h | |
bool operator!=
(
const TWeakObjectPtr< RhsT, TWeakObjectPtrBase >& Rhs |
Compare weak pointers for inequality | UObject/WeakObjectPtrTemplates.h | |
bool operator!=
(
const RhsT* Rhs |
UObject/WeakObjectPtrTemplates.h | ||
bool operator!=
(
TYPE_OF_NULLPTR |
UObject/WeakObjectPtrTemplates.h | ||
T & operator*() |
Dereference the weak pointer | UObject/WeakObjectPtrTemplates.h | |
TWeakObjectPtr & operator=
(
const TWeakObjectPtr< OtherT, TWeakObjectPtrBase >& Other |
Assign from another weak pointer, intended for derived-to-base conversions | UObject/WeakObjectPtrTemplates.h | |
TWeakObjectPtr & operator=
(
const TWeakObjectPtr& |
UObject/WeakObjectPtrTemplates.h | ||
TWeakObjectPtr & operator=
(
U* Object |
Copy from an object pointer | UObject/WeakObjectPtrTemplates.h | |
T * operator->() |
Dereference the weak pointer | UObject/WeakObjectPtrTemplates.h |