Just ran into this issue. The solution is simple but you have to understand how the building process works.
Everything in the engine is basically a class. These classes then reference each other, for example by containing a variable into which you placed one of your data assets, and you end up with a whole hierarchy of references. A reference basically tells the engine, “Hey, I’m gonna need this class at some point”.
I will give you an example. Let’s say that you have a map. That is the base where the hierarchy starts. Then on the map, you have an actor that has a static mesh component. So the map is referencing the actor and you have two references in the hierarchy. Now let’s say that the actor has an array variable into which you want to place some data asset that contains a mesh. On event being play, the actor will randomly choose one of the data assets and set the static mesh component in the actor to the mesh in the data asset.
But for now you haven’t added any data assets to the array variable. You just have the map, the actor on it and a bunch of data assets in a folder.
You build the game, use the asset registry to loop through all the classes and you notice that your data assets ar missing. Well, that’s because they weren’t referenced by any other class and the build process didn’t include them into the game to save space.
Now if you go back into the actor some of the data assets to the array variable, they will be referenced and you reference hierarchy will contain the map, actor, and the data assets that you added to the array variable.
Now if you build the game and loop through all the classes again, you will notice that the data assets you added to the array variable are found, and the ones you didn’t are missing.
So, if you aren’t going to reference the data assets anywhere but intend to access them at a later point in time, you need to tell the engine to include them in the build even if they are not being referenced.
Go to your project settings > packaging > under the section “additional asset directories to cook” click the plus icon and add the folder containing your data assets. Now any files in this folder will always be added to the build.