UAssetManager::GetContentRootPathFromPackageName
#include "Engine/AssetManager.h"
Access: public
Specifiers: static
Description
Returns the root mount path for a package name or path — for example /Game/MyPackage returns /Game/. Works even if the root isn't currently mounted.
Caveats & Gotchas
- • Because it's a static utility that works on unmounted roots, it's purely string parsing — it does not verify the path corresponds to an actual mounted content directory.
- • Useful for classifying assets by plugin/content root (e.g. distinguishing /Game/ from a plugin's /MyPlugin/) without needing a live asset registry query.
Signature
static bool GetContentRootPathFromPackageName(const FString& PackageName, FString& OutContentRootPath) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| PackageName | const FString& | Package name or path to extract the mount-point root from. | — |
| OutContentRootPath | FString& | Filled with the root path, e.g. /Game/. | — |
Return Type
bool Example
Extract the mount root from a package name C++
FString RootPath;
if (UAssetManager::GetContentRootPathFromPackageName(TEXT("/Game/Items/BP_Sword"), RootPath))
{
// RootPath == TEXT("/Game/")
} Tags
Version History
Introduced in: 4.22
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?