UKismetSystemLibrary::GetSoftObjectReferenceFromPrimaryAssetId
#include "Kismet/KismetSystemLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns the soft object reference (path) associated with a Primary Asset Id. Unlike GetObjectFromPrimaryAssetId, this works even if the asset is not loaded.
Caveats & Gotchas
- • The Asset Manager must have already scanned and registered the asset for this to resolve to a valid path; otherwise the returned soft reference is null.
- • This does not load the asset — the returned TSoftObjectPtr must still be loaded synchronously or asynchronously before dereferencing.
Signature
static TSoftObjectPtr<UObject> GetSoftObjectReferenceFromPrimaryAssetId(FPrimaryAssetId PrimaryAssetId) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| PrimaryAssetId | FPrimaryAssetId | The Primary Asset Id to convert. | — |
Return Type
TSoftObjectPtr<UObject> Example
Get a loadable reference without loading C++
FPrimaryAssetId AssetId(FName("Item"), FName("Sword_Iron"));
TSoftObjectPtr<UObject> SoftRef = UKismetSystemLibrary::GetSoftObjectReferenceFromPrimaryAssetId(AssetId);
if (!SoftRef.IsNull())
{
UE_LOG(LogTemp, Log, TEXT("Path: %s"), *SoftRef.ToSoftObjectPath().ToString());
} See Also
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?