FSoftObjectPath

A struct that contains a string reference to an object, either a top level asset or a subobject.

Windows
MacOS
Linux

Inheritance Hierarchy

FSoftObjectPath

FSoftClassPath

References

Module

CoreUObject

Header

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

Include

#include "UObject/SoftObjectPath.h"

Syntax

struct FSoftObjectPath

Remarks

A struct that contains a string reference to an object, either a top level asset or a subobject. This can be used to make soft references to assets that are loaded on demand. This is stored internally as an FName pointing to the top level asset (/package/path.assetname) and an option a string subobject path. If the MetaClass metadata is applied to a UProperty with this the UI will restrict to that type of asset.

Constructors

Name Description

Public function

FSoftObjectPath()

Public function

FSoftObjectPath

(
    const FSoftObjectPath& Other
)

Construct from another soft object path

Public function

FSoftObjectPath

(
    FSoftObjectPath&& Other
)

Construct from a moveable soft object path

Public function

FSoftObjectPath

(
    FString PathString
)

Construct from a path string

Public function

FSoftObjectPath

(
    const UObject* InObject
)

Construct from an existing object in memory

Public function

FSoftObjectPath

(
    FName InAssetPathName,
    FString InSubPathString
)

Construct from an asset FName and subobject pair

Destructors

Name Description

Public function

~FSoftObjectPath()

Functions

Name Description

Public function Static

void

 

AddPIEPackageName

(
    FName NewPIEPackageName
)

Adds list of packages names that have been created specifically for PIE, this is used for editor fixup

Public function Static

void

 

ClearPIEPackageNames()

Disables special PIE path handling, call when PIE finishes to clear list

Public function Const

bool

 

ExportTextItem

(
    FString& ValueStr,
    FSoftObjectPath const& DefaultValu...,
    UObject* Parent,
    int32 PortFlags,
    UObject* ExportRootScope
)

Public function

bool

 

FixupCoreRedirects()

Fixes soft object path for CoreRedirects to handle renamed native objects, returns true if it was modified

Public function

bool

 

FixupForPIE

(
    int32 PIEInstance
)

Fixes up this SoftObjectPath to add the PIE prefix for the given PIEInstance index, returns true if it was modified

Public function

bool

 

FixupForPIE()

Fixes up this SoftObjectPath to add the PIE prefix depending on what is currently active, returns true if it was modified.

Public function Const

FString

 

GetAssetName()

Returns assetname string, leaving off the /package/path part and sub object

Public function Const

FName

 

GetAssetPathName()

Returns the entire asset path as an FName, including both package and asset but not sub object

Public function Const

FString

 

GetAssetPathString()

Returns string version of asset path, including both package and asset but not sub object

Public function Static

int32

 

GetCurrentTag()

Code needed by FSoftObjectPtr internals

Public function Const

FString

 

GetLongPackageName()

Returns /package/path, leaving off the asset name and sub object

Public function Static

FSoftObjectP...

 

GetOrCreateIDForObject

(
    const UObject* Object
)

Public function Const

const FStrin...

 

GetSubPathString()

Returns the sub path, which is often empty

Public function

bool

 

ImportTextItem

(
    const TCHAR*& Buffer,
    int32 PortFlags,
    UObject* Parent,
    FOutputDevice* ErrorText,
    FArchive* InSerializingArchive
)

Public function Static

int32

 

InvalidateTag()

Public function Const

bool

 

IsAsset()

Check if this represents an asset, meaning it is not null but does not have a sub path

Public function Const

bool

 

IsNull()

Checks to see if this is initialized to null

Public function Const

bool

 

IsSubobject()

Check if this represents a sub object, meaning it has a sub path

Public function Const

bool

 

IsValid()

Check if this could possibly refer to a real object, or was initialized to null

Public function Const

void

 

PostLoadPath

(
    FArchive* InArchive
)

Handles when a path has been loaded, call if loading with a method that skips SerializePath.

Public function

bool

 

PreSavePath

(
    bool* bReportSoftObjectPathRed...
)

Fixes up path for saving, call if saving with a method that skips SerializePath.

Public function

void

 

Reset()

Resets reference to point to null

Public function Const

UObject *...

 

ResolveObject()

Attempts to find a currently loaded object that matches this path

Public function

bool

 

Serialize

(
    FArchive& Ar
)

Struct overrides

Public function

bool

 

Serialize

(
    FStructuredArchive::FSlot Slot
)

Struct overrides

Public function

bool

 

SerializeFromMismatchedTag

(
    FPropertyTag const& Tag,
    FStructuredArchive::FSlot Slot
)

Public function

void

 

SerializePath

(
    FArchive& Ar
)

Serializes the internal path and also handles save/PIE fixups.

Public function

void

 

SetPath

(
    FString Path
)

Sets asset path of this reference based on a string path

Public function Const

FString

 

ToString()

Returns string representation of reference, in form /package/path.assetname[:subpath]

Public function Const

UObject *...

 

TryLoad

(
    FUObjectSerializeContext* InLo...
)

Attempts to load the asset, this will call LoadObject which can be very slow

Operators

Name Description

Public function Const

bool

 

operator!=

(
    FSoftObjectPath const& Other
)

Public function

FSoftObjectP...

 

operator=

(
    FSoftObjectPath Other
)

Public function Const

bool

 

operator==

(
    FSoftObjectPath const& Other
)

Constants

Name

Description

CurrentTag

Global counter that determines when we need to re-search based on path because more objects have been loaded

PIEPackageNames

Package names currently being duplicated, needed by FixupForPIE

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