# Using GetPrimaryAssetDataList to return a list of primary data assets

**URL:** <https://forums.unrealengine.com/t/using-getprimaryassetdatalist-to-return-a-list-of-primary-data-assets/2444158>\
**Category:** C++\
**Tags:** data-asset, unreal-engine, CPP\
**Created:** [April 7, 2025, 3:37am UTC](https://forums.unrealengine.com/t/using-getprimaryassetdatalist-to-return-a-list-of-primary-data-assets/2444158 "2025-04-07T03:37:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ZerbuTabek](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ZerbuTabek](https://forums.unrealengine.com/u/ZerbuTabek)\
**Post date:** [April 7, 2025, 3:37am UTC](https://forums.unrealengine.com/t/using-getprimaryassetdatalist-to-return-a-list-of-primary-data-assets/2444158/1 "2025-04-07T03:37:15Z")

</div>

I’m trying to load all data assets of a certain type using GetPrimaryAssetDataList, but I just can’t get it to work.

- I have a test blueprint class named “MenuItem” inheriting primary data class.
- I have three test data assets: MenuItem\_1, Menuitem\_2 and MenuItem\_3
- In Primary Asset Types to Scan, I added a section named “MenuItem”, with Asset Base Class set to my MenuItem class.
- Has Blueprint Classes is **not** checked (since I’m looking for data assets, not blueprint subclasses).
- The directory is set to /Game/TestMenu, I have double checked 1000 times to make sure the data assets are in the correct location.

Here is the code that is failing:

```auto
TArray<FAssetData> Assets;
UAssetManager::Get().GetPrimaryAssetDataList(PrimaryAssetType, Assets);

```

When I try to load something else, like a list of blueprint subclasses, it **does** work, so the issue is definitely with the specific type, and **not** with where the asset manager is referenced.

Why won’t this work with primary data assets though? Am I missing a step? I also tried with a class created in C++ instead of Blueprint, but that didn’t work either.

---

<div class="post-metadata">

**Author:** ![MagForceSeven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/magforceseven/32/906563_2.png) [@MagForceSeven](https://forums.unrealengine.com/u/MagForceSeven)\
**Post date:** [April 7, 2025, 1:09pm UTC](https://forums.unrealengine.com/t/using-getprimaryassetdatalist-to-return-a-list-of-primary-data-assets/2444158/2 "2025-04-07T13:09:04Z")

</div>

What is that `PrimaryAssetType` variable set to? Have you overwritten `GetPrimaryAssetID`? I don’t think the default implementation of that function works for blueprint base classes (but it should have worked with your C++ base class though).

---

<div class="post-metadata">

**Author:** ![ZerbuTabek](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ZerbuTabek](https://forums.unrealengine.com/u/ZerbuTabek)\
**Post date:** [April 7, 2025, 5:16pm UTC](https://forums.unrealengine.com/t/using-getprimaryassetdatalist-to-return-a-list-of-primary-data-assets/2444158/3 "2025-04-07T17:16:47Z")

</div>

The PrimaryAssetType is “MenuItem”, I know that’s not the problem because it works when I change it to look for blueprint subclasses instead.

My temporary solution to the problem I’m having is to use GetAssetsByClass. As long as the directory and type is defined somewhere in Primary Assets to Scan, it forces them to load on startup.
