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

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback