Choose your operating system:
Windows
macOS
Linux
Module |
|
Header |
/Engine/Source/Runtime/CoreUObject/Public/UObject/WeakObjectPtr.h |
Include |
#include "UObject/WeakObjectPtr.h" |
struct FWeakObjectPtr
FWeakObjectPtr is a weak pointer to a UObject. It can return nullptr later if the object is garbage collected. It has no impact on if the object is garbage collected or not. It can't be directly used across a network.
Most often it is used when you explicitly do NOT want to prevent something from being garbage collected.
Name | Description | |
---|---|---|
|
FWeakObjectPtr() |
Null constructor |
|
FWeakObjectPtr |
Construct from nullptr or something that can be implicitly converted to nullptr (eg: NULL) |
|
FWeakObjectPtr ( |
Construct from an object pointer or something that can be implicitly converted to an object pointer |
|
FWeakObjectPtr ( |
Construct from another weak pointer |
Name | Description | ||
---|---|---|---|
|
UObject *... |
Get ( |
Dereference the weak pointer. |
|
UObject *... |
Get() |
Dereference the weak pointer. This is an optimized version implying bEvenIfPendingKill=false. |
|
UObject *... |
GetEvenIfUnreachable() |
Dereference the weak pointer even if it is RF_PendingKill or RF_Unreachable |
|
GetObjectIndex() |
||
|
HasSameIndexAndSerialNumber ( |
Returns true if two weak pointers were originally set to the same object, even if they are now stale |
|
|
IsExplicitlyNull() |
Returns true if this pointer was explicitly assigned to null, was reset, or was never initialized. |
|
|
IsStale |
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. |
|
|
IsValid() |
Test if this points to a live UObject. |
|
|
IsValid |
Test if this points to a live UObject |
|
|
Reset() |
Reset the weak pointer back to the null state |
|
|
Serialize ( |
Weak object pointer serialization. |
Name | Description | ||
---|---|---|---|
|
operator!= ( |
Compare weak pointers for inequality |
|
|
operator= ( |
Copy from an object pointer |
|
|
FWeakObjectP... |
operator= ( |
Construct from another weak pointer |
|
operator== ( |
Compare weak pointers for equality. |