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

#include <SoftObjectPtr.h>

Public Types

using ElementType = T
 

Public Member Functions

UE_FORCEINLINE_HINT TSoftObjectPtr ()=default
 
UE_FORCEINLINE_HINT TSoftObjectPtr (const TSoftObjectPtr &Other)=default
 
UE_FORCEINLINE_HINT TSoftObjectPtr (TSoftObjectPtr &&Other)=default
 
UE_FORCEINLINE_HINT ~TSoftObjectPtr ()=default
 
UE_FORCEINLINE_HINT TSoftObjectPtroperator= (const TSoftObjectPtr &Other)=default
 
UE_FORCEINLINE_HINT TSoftObjectPtroperator= (TSoftObjectPtr &&Other)=default
 
template<class U >
UE_FORCEINLINE_HINT TSoftObjectPtr (const TSoftObjectPtr< U > &Other)
 
template<class U >
UE_FORCEINLINE_HINT TSoftObjectPtr (const TSoftObjectPtr< U > &Other)
 
template<class U >
UE_FORCEINLINE_HINT TSoftObjectPtr (TSoftObjectPtr< U > &&Other)
 
template<class U >
UE_FORCEINLINE_HINT TSoftObjectPtr (TSoftObjectPtr< U > &&Other)
 
template<typename U >
UE_FORCEINLINE_HINT TSoftObjectPtr (U *Object)
 
template<typename U >
UE_FORCEINLINE_HINT TSoftObjectPtr (U *Object)
 
template<typename U >
UE_FORCEINLINE_HINT TSoftObjectPtr (const TObjectPtr< U > Object)
 
template<typename U >
UE_FORCEINLINE_HINT TSoftObjectPtr (const TObjectPtr< U > Object)
 
UE_FORCEINLINE_HINT TSoftObjectPtr (TYPE_OF_NULLPTR)
 
template<typename SoftObjectPathType >
UE_FORCEINLINE_HINT TSoftObjectPtr (SoftObjectPathType ObjectPath)
 
 TSoftObjectPtr (const FString &Path)
 
UE_FORCEINLINE_HINT void Reset ()
 
UE_FORCEINLINE_HINT void ResetWeakPtr ()
 
template<typename U >
TSoftObjectPtroperator= (U *Object)
 
template<typename U >
TSoftObjectPtroperator= (U *Object)
 
template<typename U >
TSoftObjectPtroperator= (const TObjectPtr< U > Object)
 
template<typename U >
TSoftObjectPtroperator= (const TObjectPtr< U > Object)
 
TSoftObjectPtroperator= (TYPE_OF_NULLPTR)
 
TSoftObjectPtroperator= (FSoftObjectPath ObjectPath)
 
template<class U >
TSoftObjectPtroperator= (const TWeakObjectPtr< U > &Other)
 
template<class U >
TSoftObjectPtroperator= (const TWeakObjectPtr< U > &Other)
 
template<class U >
TSoftObjectPtroperator= (TSoftObjectPtr< U > Other)
 
template<class U >
TSoftObjectPtroperator= (TSoftObjectPtr< U > Other)
 
UE_FORCEINLINE_HINT bool operator== (const TSoftObjectPtr &Rhs) const
 
template<typename U >
UE_FORCEINLINE_HINT bool operator== (const TSoftObjectPtr< U > &Rhs) const
 
template<typename U >
UE_FORCEINLINE_HINT bool operator== (const TSoftObjectPtr< U > &Rhs) const
 
template<typename U >
UE_FORCEINLINE_HINT bool operator== (U *Rhs) const
 
template<typename U >
UE_FORCEINLINE_HINT bool operator== (U *Rhs) const
 
UE_FORCEINLINE_HINT bool operator== (TYPE_OF_NULLPTR) const
 
T * Get () const
 
UE_FORCEINLINE_HINT T & operator* () const
 
UE_FORCEINLINE_HINT T * operator-> () const
 
T * LoadSynchronous () const
 
int32 LoadAsync (FLoadSoftObjectPathAsyncDelegate InCompletionDelegate, FLoadAssetAsyncOptionalParams InOptionalParams=FLoadAssetAsyncOptionalParams()) const
 
UE_FORCEINLINE_HINT bool IsValid () const
 
UE_FORCEINLINE_HINT bool IsPending () const
 
UE_FORCEINLINE_HINT bool IsNull () const
 
UE_FORCEINLINE_HINT const FSoftObjectPathGetUniqueID () const
 
UE_FORCEINLINE_HINT const FSoftObjectPathToSoftObjectPath () const
 
UE_FORCEINLINE_HINT FString ToString () const
 
UE_FORCEINLINE_HINT FString GetLongPackageName () const
 
UE_FORCEINLINE_HINT FName GetLongPackageFName () const
 
UE_FORCEINLINE_HINT FString GetAssetName () const
 
UE_FORCEINLINE_HINT operator bool () const
 
UE_FORCEINLINE_HINT uint32 GetPtrTypeHash () const
 
UE_FORCEINLINE_HINT void Serialize (FArchive &Ar)
 

Friends

template<class U >
struct TSoftObjectPtr
 

Detailed Description

template<class T = UObject>
struct TSoftObjectPtr< T >

TSoftObjectPtr is templatized wrapper of the generic FSoftObjectPtr, it can be used in UProperties

Member Typedef Documentation

◆ ElementType

template<class T = UObject>
using TSoftObjectPtr< T >::ElementType = T

Constructor & Destructor Documentation

◆ TSoftObjectPtr() [1/14]

template<class T = UObject>
UE_FORCEINLINE_HINT TSoftObjectPtr< T >::TSoftObjectPtr ( )
default

◆ TSoftObjectPtr() [2/14]

template<class T = UObject>
UE_FORCEINLINE_HINT TSoftObjectPtr< T >::TSoftObjectPtr ( const TSoftObjectPtr< T > &  Other)
default

◆ TSoftObjectPtr() [3/14]

template<class T = UObject>
UE_FORCEINLINE_HINT TSoftObjectPtr< T >::TSoftObjectPtr ( TSoftObjectPtr< T > &&  Other)
default

◆ ~TSoftObjectPtr()

template<class T = UObject>
UE_FORCEINLINE_HINT TSoftObjectPtr< T >::~TSoftObjectPtr ( )
default

◆ TSoftObjectPtr() [4/14]

template<class T = UObject>
template<class U >
UE_FORCEINLINE_HINT TSoftObjectPtr< T >::TSoftObjectPtr ( const TSoftObjectPtr< U > &  Other)
inline

Construct from another soft pointer

◆ TSoftObjectPtr() [5/14]

template<class T = UObject>
template<class U >
UE_FORCEINLINE_HINT TSoftObjectPtr< T >::TSoftObjectPtr ( const TSoftObjectPtr< U > &  Other)
inline

◆ TSoftObjectPtr() [6/14]

template<class T = UObject>
template<class U >
UE_FORCEINLINE_HINT TSoftObjectPtr< T >::TSoftObjectPtr ( TSoftObjectPtr< U > &&  Other)
inline

Construct from a moveable soft pointer

◆ TSoftObjectPtr() [7/14]

template<class T = UObject>
template<class U >
UE_FORCEINLINE_HINT TSoftObjectPtr< T >::TSoftObjectPtr ( TSoftObjectPtr< U > &&  Other)
inline

◆ TSoftObjectPtr() [8/14]

template<class T = UObject>
template<typename U >
UE_FORCEINLINE_HINT TSoftObjectPtr< T >::TSoftObjectPtr ( U *  Object)
inline

Construct from an object already in memory

◆ TSoftObjectPtr() [9/14]

template<class T = UObject>
template<typename U >
UE_FORCEINLINE_HINT TSoftObjectPtr< T >::TSoftObjectPtr ( U *  Object)
inline

◆ TSoftObjectPtr() [10/14]

template<class T = UObject>
template<typename U >
UE_FORCEINLINE_HINT TSoftObjectPtr< T >::TSoftObjectPtr ( const TObjectPtr< U >  Object)
inline

Construct from a TObjectPtr which may or may not be in memory.

◆ TSoftObjectPtr() [11/14]

template<class T = UObject>
template<typename U >
UE_FORCEINLINE_HINT TSoftObjectPtr< T >::TSoftObjectPtr ( const TObjectPtr< U >  Object)
inline

◆ TSoftObjectPtr() [12/14]

template<class T = UObject>
UE_FORCEINLINE_HINT TSoftObjectPtr< T >::TSoftObjectPtr ( TYPE_OF_NULLPTR  )
inline

Construct from a nullptr

◆ TSoftObjectPtr() [13/14]

template<class T = UObject>
UE_FORCEINLINE_HINT TSoftObjectPtr< T >::TSoftObjectPtr ( SoftObjectPathType  ObjectPath)
inlineexplicit

Construct from a soft object path

◆ TSoftObjectPtr() [14/14]

template<class T = UObject>
TSoftObjectPtr< T >::TSoftObjectPtr ( const FString &  Path)
inlineexplicit

Member Function Documentation

◆ Get()

template<class T >
T * TSoftObjectPtr< T >::Get ( ) const

Dereference the soft pointer.

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

Not directly inlined on purpose so compiler have the option of not inlining it. (and it also works with extern template)

◆ GetAssetName()

template<class T = UObject>
UE_FORCEINLINE_HINT FString TSoftObjectPtr< T >::GetAssetName ( ) const
inline

Returns assetname string, leaving off the /package/path part

◆ GetLongPackageFName()

template<class T = UObject>
UE_FORCEINLINE_HINT FName TSoftObjectPtr< T >::GetLongPackageFName ( ) const
inline

Returns /package/path name, leaving off the asset name

◆ GetLongPackageName()

template<class T = UObject>
UE_FORCEINLINE_HINT FString TSoftObjectPtr< T >::GetLongPackageName ( ) const
inline

Returns /package/path string, leaving off the asset name

◆ GetPtrTypeHash()

template<class T = UObject>
UE_FORCEINLINE_HINT uint32 TSoftObjectPtr< T >::GetPtrTypeHash ( ) const
inline

Hash function

◆ GetUniqueID()

template<class T = UObject>
UE_FORCEINLINE_HINT const FSoftObjectPath & TSoftObjectPtr< T >::GetUniqueID ( ) const
inline

Returns the StringObjectPath that is wrapped by this SoftObjectPtr

◆ IsNull()

template<class T = UObject>
UE_FORCEINLINE_HINT bool TSoftObjectPtr< T >::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 T = UObject>
UE_FORCEINLINE_HINT bool TSoftObjectPtr< T >::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

◆ IsValid()

template<class T = UObject>
UE_FORCEINLINE_HINT bool TSoftObjectPtr< T >::IsValid ( ) const
inline

Test if this points to a live UObject

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

◆ LoadAsync()

template<class T = UObject>
int32 TSoftObjectPtr< T >::LoadAsync ( FLoadSoftObjectPathAsyncDelegate  InCompletionDelegate,
FLoadAssetAsyncOptionalParams  InOptionalParams = FLoadAssetAsyncOptionalParams() 
) const
inline

Attempts to asynchronously load the object referenced by this soft pointer. This is a wrapper around the LoadAsync function in SoftObjectPath, and the delegate is responsible for validating it loaded the correct type

Parameters
InCompletionDelegateDelegate to be invoked when the async load finishes, this will execute on the game thread as soon as the load succeeds or fails
InOptionalParamsOptional parameters for async loading the asset
Returns
Unique ID associated with this load request (the same object or package can be associated with multiple IDs).

◆ LoadSynchronous()

template<class T = UObject>
T * TSoftObjectPtr< T >::LoadSynchronous ( ) const
inline

Synchronously load (if necessary) and return the asset object represented by this asset ptr

◆ operator bool()

template<class T = UObject>
UE_FORCEINLINE_HINT TSoftObjectPtr< T >::operator bool ( ) const
inlineexplicit

Dereference soft pointer to see if it points somewhere valid

◆ operator*()

template<class T = UObject>
UE_FORCEINLINE_HINT T & TSoftObjectPtr< T >::operator* ( ) const
inline

Dereference the soft pointer

◆ operator->()

template<class T = UObject>
UE_FORCEINLINE_HINT T * TSoftObjectPtr< T >::operator-> ( ) const
inline

Dereference the soft pointer

◆ operator=() [1/12]

template<class T = UObject>
template<typename U >
TSoftObjectPtr & TSoftObjectPtr< T >::operator= ( const TObjectPtr< U >  Object)
inline

Copy from a TObjectPtr which may or may not be in memory.

◆ operator=() [2/12]

template<class T = UObject>
template<typename U >
TSoftObjectPtr & TSoftObjectPtr< T >::operator= ( const TObjectPtr< U >  Object)
inline

◆ operator=() [3/12]

template<class T = UObject>
UE_FORCEINLINE_HINT TSoftObjectPtr & TSoftObjectPtr< T >::operator= ( const TSoftObjectPtr< T > &  Other)
default

◆ operator=() [4/12]

template<class T = UObject>
template<class U >
TSoftObjectPtr & TSoftObjectPtr< T >::operator= ( const TWeakObjectPtr< U > &  Other)
inline

Copy from a weak pointer to an object already in memory

◆ operator=() [5/12]

template<class T = UObject>
template<class U >
TSoftObjectPtr & TSoftObjectPtr< T >::operator= ( const TWeakObjectPtr< U > &  Other)
inline

◆ operator=() [6/12]

template<class T = UObject>
TSoftObjectPtr & TSoftObjectPtr< T >::operator= ( FSoftObjectPath  ObjectPath)
inline

Copy from a soft object path

◆ operator=() [7/12]

template<class T = UObject>
UE_FORCEINLINE_HINT TSoftObjectPtr & TSoftObjectPtr< T >::operator= ( TSoftObjectPtr< T > &&  Other)
default

◆ operator=() [8/12]

template<class T = UObject>
template<class U >
TSoftObjectPtr & TSoftObjectPtr< T >::operator= ( TSoftObjectPtr< U >  Other)
inline

Copy from another soft pointer

◆ operator=() [9/12]

template<class T = UObject>
template<class U >
TSoftObjectPtr & TSoftObjectPtr< T >::operator= ( TSoftObjectPtr< U >  Other)
inline

◆ operator=() [10/12]

template<class T = UObject>
TSoftObjectPtr & TSoftObjectPtr< T >::operator= ( TYPE_OF_NULLPTR  )
inline

Assign from a nullptr

◆ operator=() [11/12]

template<class T = UObject>
template<typename U >
TSoftObjectPtr & TSoftObjectPtr< T >::operator= ( U *  Object)
inline

Copy from an object already in memory

◆ operator=() [12/12]

template<class T = UObject>
template<typename U >
TSoftObjectPtr & TSoftObjectPtr< T >::operator= ( U *  Object)
inline

◆ operator==() [1/6]

template<class T = UObject>
UE_FORCEINLINE_HINT bool TSoftObjectPtr< T >::operator== ( const TSoftObjectPtr< T > &  Rhs) const
inline

Compare soft pointers for equality Caution: Two soft pointers might not be equal to each other, but they both might return nullptr

Parameters
Othersoft pointer to compare to

◆ operator==() [2/6]

template<class T = UObject>
template<typename U >
UE_FORCEINLINE_HINT bool TSoftObjectPtr< T >::operator== ( const TSoftObjectPtr< U > &  Rhs) const
inline

◆ operator==() [3/6]

template<class T = UObject>
template<typename U >
UE_FORCEINLINE_HINT bool TSoftObjectPtr< T >::operator== ( const TSoftObjectPtr< U > &  Rhs) const
inline

◆ operator==() [4/6]

template<class T = UObject>
UE_FORCEINLINE_HINT bool TSoftObjectPtr< T >::operator== ( TYPE_OF_NULLPTR  ) const
inline

◆ operator==() [5/6]

template<class T = UObject>
template<typename U >
UE_FORCEINLINE_HINT bool TSoftObjectPtr< T >::operator== ( U *  Rhs) const
inline

◆ operator==() [6/6]

template<class T = UObject>
template<typename U >
UE_FORCEINLINE_HINT bool TSoftObjectPtr< T >::operator== ( U *  Rhs) const
inline

◆ Reset()

template<class T = UObject>
UE_FORCEINLINE_HINT void TSoftObjectPtr< T >::Reset ( )
inline

Reset the soft pointer back to the null state

◆ ResetWeakPtr()

template<class T = UObject>
UE_FORCEINLINE_HINT void TSoftObjectPtr< T >::ResetWeakPtr ( )
inline

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

◆ Serialize()

template<class T = UObject>
UE_FORCEINLINE_HINT void TSoftObjectPtr< T >::Serialize ( FArchive Ar)
inline

◆ ToSoftObjectPath()

template<class T = UObject>
UE_FORCEINLINE_HINT const FSoftObjectPath & TSoftObjectPtr< T >::ToSoftObjectPath ( ) const
inline

Returns the StringObjectPath that is wrapped by this SoftObjectPtr

◆ ToString()

template<class T = UObject>
UE_FORCEINLINE_HINT FString TSoftObjectPtr< T >::ToString ( ) const
inline

Returns string representation of reference, in form /package/path.assetname

Friends And Related Symbol Documentation

◆ TSoftObjectPtr

template<class T = UObject>
template<class U >
friend struct TSoftObjectPtr
friend

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