FPrimaryAssetType vs enum

Hi All,

So I was checking the ActionRPG project from epic and I saw the Item system they created:

class ACTIONRPG_API URPGAssetManager : public UAssetManager
    // Constructor and overrides
    URPGAssetManager() {}
    virtual void StartInitialLoading() override;
    /** Static types for items */
    static const FPrimaryAssetType  PotionItemType;
    static const FPrimaryAssetType  SkillItemType;
    static const FPrimaryAssetType  TokenItemType;
    static const FPrimaryAssetType  WeaponItemType;
    /** Returns the current AssetManager object */
    static URPGAssetManager& Get();
     * Synchronously loads an RPGItem subclass, this can hitch but is useful when you cannot wait for an async load
     * This does not maintain a reference to the item so it will garbage collect if not loaded some other way
     * @param PrimaryAssetId The asset identifier to load
     * @param bDisplayWarning If true, this will log a warning if the item failed to load
    URPGItem* ForceLoadItem(const FPrimaryAssetId& PrimaryAssetId, bool bLogWarning = true);

And items have that primary asset type:

UCLASS(Abstract, BlueprintType)
class ACTIONRPG_API URPGItem : public UPrimaryDataAsset
    /** Constructor */
        : Price(0)
        , MaxCount(1)
        , MaxLevel(1)
        , AbilityLevel(1)
    /** Type of this item, set in native parent class */
    UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Item)
    FPrimaryAssetType ItemType;

and each item definition extends this:

class ACTIONRPG_API URPGPotionItem : public URPGItem
    /** Constructor */
        ItemType = URPGAssetManager::PotionItemType;

Is this really the unreal way of doing things ? I can imagine using an enum would be a lot easier. Is there any explanation for this ?

I’m interested as well. I’ve never used this type, so I’ve checked the source code. According to the description, this is basically just an FName, but blueprints will understand that it represents a type in some way?

* A primary asset type, represented as an FName internally and implicitly convertible back and forth
* This exists so the blueprint API can understand it's not a normal FName
struct FPrimaryAssetType

FNames are more designer friendly for systems like these generally speaking, because designers can tweak them without needing programmers to go into code and add new enum entries.

Enum is generally more useful when you have a small number of enumerations. For something that may grow exponentially over time, FName is probably better.

I am still learning about this. This struct seems to be tied to Asset Manager usage.

This makes a lot of sense, thank you very much.