TWeakPtr::Pin

Converts this weak pointer to a shared pointer that you can use to access the object (if it hasn't expired yet.) Remember, if there are no more shared references to the object, the returned shared pointer will not be valid.

Choose your operating system:

Windows

macOS

Linux

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/Templates/SharedPointer.h

Include

#include "Templates/SharedPointer.h"

Syntax

TSharedPtr< ObjectType, Mode > Pin()

Remarks

Converts this weak pointer to a shared pointer that you can use to access the object (if it hasn't expired yet.) Remember, if there are no more shared references to the object, the returned shared pointer will not be valid. You should always check to make sure the returned pointer is valid before trying to dereference the shared pointer!

Returns

Shared pointer for this object (will only be valid if still referenced!)