UKismetSystemLibrary::GetSoftClassPath
#include "Kismet/KismetSystemLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns the full path to the specified class as an FSoftClassPath, suitable for storing as a soft reference to load later.
Caveats & Gotchas
- • Returns an empty/invalid FSoftClassPath if Class is null.
- • The result is a struct with a path string, not a loaded pointer — you still need to call TryLoad() or LoadSynchronous() to resolve it.
- • Prefer GetClassTopLevelAssetPath for pure asset-identity comparisons; FSoftClassPath carries legacy long-package-name baggage that TopLevelAssetPath avoids.
Signature
static FSoftClassPath GetSoftClassPath(const UClass* Class) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Class | const UClass* | The class to convert into a soft reference. | — |
Return Type
FSoftClassPath Example
Store a class reference for later loading C++
FSoftClassPath SavedClassPath = UKismetSystemLibrary::GetSoftClassPath(AMyPawn::StaticClass());
// ... later, e.g. after a level reload ...
if (UClass* LoadedClass = SavedClassPath.TryLoadClass<AActor>())
{
UE_LOG(LogTemp, Log, TEXT("Loaded class: %s"), *LoadedClass->GetName());
} Tags
Version History
Introduced in: 4.16
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?