FSoftObjectPath::ImportTextItem
#include "UObject/SoftObjectPath.h"
Access: public
Description
Parses a text string (the complement of ExportTextItem) back into a soft object path, advancing the buffer pointer past the consumed token.
Caveats & Gotchas
- • Returns false and leaves the path unchanged if the input string is malformed — always check the return value and inspect ErrorText when parsing user-supplied or config-file strings.
- • Passing a non-null InSerializingArchive triggers immediate PostLoadPath fixup (e.g. core redirects) during parsing, which can alter the result compared to a fixup-free parse.
Signature
COREUOBJECT_API bool ImportTextItem(const TCHAR*& Buffer, int32 PortFlags, UObject* Parent, FOutputDevice* ErrorText, FArchive* InSerializingArchive = nullptr) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Buffer | const TCHAR*& | Input text buffer; the pointer is advanced past the consumed token on success. | — |
| PortFlags | int32 | Combination of EPropertyPortFlags that controls parsing behaviour. | — |
| Parent | UObject* | The outer object used for resolving relative paths. | — |
| ErrorText | FOutputDevice* | Output device that receives parse error messages. | — |
| InSerializingArchive | FArchive* | Optional archive context used to perform fixup during deserialization. | nullptr |
Return Type
bool Example
Parse a soft path from a config string C++
const FString RawPath = TEXT("/Game/Assets/MyTexture.MyTexture");
const TCHAR* Buffer = *RawPath;
FSoftObjectPath Path;
FOutputDeviceNull ErrorDev;
bool bOk = Path.ImportTextItem(Buffer, PPF_None, nullptr, &ErrorDev);
if (bOk)
{
UE_LOG(LogTemp, Log, TEXT("Parsed: %s"), *Path.ToString());
} Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?