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 FProperty with this the UI will restrict to that type of asset.

Constructors

Name Description

Public function

FSoftObjectPath()

Public function

FSoftObjectPath

(
    TYPE_OF_NULLPTR
)

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

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

(
    const FString& Path
)

Construct from a path string. Non-explicit for backwards compatibility.

Public function

FSoftObjectPath

(
    FWideStringView Path
)

Public function

FSoftObjectPath

(
    FAnsiStringView Path
)

Public function

FSoftObjectPath

(
    FName Path
)

Public function

FSoftObjectPath

(
    const WIDECHAR* Path
)

Public function

FSoftObjectPath

(
    const ANSICHAR* Path
)

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

(
    FStructuredArchive::FSlot Slot
)

Struct overrides

Public function

bool

 

Serialize

(
    FArchive& Ar
)

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

(
    const FString& Path
)

Public function

void

 

SetPath

(
    FWideStringView Path
)

Sets asset path of this reference based on a string path

Public function

void

 

SetPath

(
    FAnsiStringView Path
)

Sets asset path of this reference based on a string path

Public function

void

 

SetPath

(
    FName Path
)

Sets asset path of this reference based on a string path

Public function

void

 

SetPath

(
    const WIDECHAR* Path
)

Public function

void

 

SetPath

(
    const ANSICHAR* Path
)

Public function Const

void

 

ToString

(
    FStringBuilderBase& Builder
)

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

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=

(
    const FString& Path
)

Public function

FSoftObjectP...

 

operator=

(
    FWideStringView Path
)

Public function

FSoftObjectP...

 

operator=

(
    FAnsiStringView Path
)

Public function

FSoftObjectP...

 

operator=

(
    FName Path
)

Public function

FSoftObjectP...

 

operator=

(
    const WIDECHAR* Path
)

Public function

FSoftObjectP...

 

operator=

(
    const ANSICHAR* Path
)

Public function

FSoftObjectP...

 

operator=

(
    TYPE_OF_NULLPTR
)

Public function

FSoftObjectP...

 

operator=

(
    FSoftObjectPath&& Path
)

Public function

FSoftObjectP...

 

operator=

(
    const FSoftObjectPath& Path
)

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

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