FSoftObjectPtr

[FSoftObjectPtr](API\Runtime\CoreUObject\UObject\FSoftObjectPtr) is a type of weak pointer to a [UObject](API\Runtime\CoreUObject\UObject\UObject), that also keeps track of the path to the object on disk.

Windows
MacOS
Linux

Inheritance Hierarchy

TPersistentObjectPtr

FSoftObjectPtr

References

Module

CoreUObject

Header

/Engine/Source/Runtime/CoreUObject/Public/UObject/SoftObjectPtr.h

Include

#include "UObject/SoftObjectPtr.h"

Syntax

struct FSoftObjectPtr : public TPersistentObjectPtr< FSoftObjectPath >

Remarks

FSoftObjectPtr is a type of weak pointer to a UObject, that also keeps track of the path to the object on disk. It will change back and forth between being Valid and Pending as the referenced object loads or unloads. It has no impact on if the object is garbage collected or not.

This is useful to specify assets that you may want to asynchronously load on demand.

Constructors

Name Description

Public function

FSoftObjectPtr()

Default constructor, will be null

Public function

FSoftObjectPtr

(
    const FSoftObjectPtr& Other
)

Construct from another soft pointer

Public function

FSoftObjectPtr

(
    const FSoftObjectPath& ObjectPath
)

Construct from a soft object path

Public function

FSoftObjectPtr

(
    const UObject* Object
)

Construct from an object already in memory

Functions

Name Description

Public function Const

UObject *...

 

Get()

Overridden to deal with PIE lookups

Public function Const

FString

 

GetAssetName()

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

Public function Const

FString

 

GetLongPackageName()

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

Public function Const

UObject *...

 

LoadSynchronous()

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

Public function Const

const FSoftO...

 

ToSoftObjectPath()

Returns the StringObjectPath that is wrapped by this SoftObjectPtr

Public function Const

FString

 

ToString()

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

Deprecated Functions

Name Description

Public function Const

const FSoftO...

 

ToStringReference()

ToStringReference was renamed to ToSoftObjectPath

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss