Anybody has an idea how to dynamically load assets in BP?

After wasting 2 days based on Epics announcement that in “4.17 the asset registry is now BP ready and allows you to load stuff dynamically” I found out that this is great when you PIE but it doesn’t work in packed games as these guys here have discovered before me. Apparently there are some ideas to get this working in 4.19 but then maybe not.

So the only way to load assets that are placed dynamically during gameplay is to have a static array, for instance in your game mode, with asset ptrs where you reference assets explicitely and then chose an asset based on array index.

It seems to me that this slows down the loading process because all assets are loaded at startup, I think at least.

Has anybody discovered a trick ow to load assets at will without preloading them first? Something that actually works in a shipped version?

Does anybody have an answer? I mean I can’t be the only one who has a directory full of assets but only needs to load selective ones at specific times?

Can you please clarify, what do you mean by “assets” ? Foreign .dll files, that contain functions you want?

Thanks for answering.
I mean objects in game, mostly blueprints that contain either static or skeletal meshes or combinations.
I also need to load Texture2D objects to show as icons in an inventory.
My current solution is an array in the Gamemode that contains direct references to those assets and I believe when my game starts, all of them are loaded into Ram.
I tried to incorporate the new stuff from UE 4.17 but it seems the AssetRegistry is an object that only exists in the editor and not in the shipped game.
Since I know where the assets are and I dont need a means to browse the directories, I tried loading them directly, which works in PIE but not in the packed game. Here is a picture of how I tried to load them:

When I execute that, it returns success in PIE but doesn’t find the asset in the shipping version. I packed the game without PAK files so that I could verify that the packer copied the assets indeed into the target directory structure, so the assets are there.

Are you using some Plugin by any chance? If so, you have to go to …/YourProject/Plugins/YourPlugin/ folder. There will be PluginName.uplugin file. It’s JSON basically. Open it with Notepad++ or Sublime (or whatever you use) and change “Type” field under “Modules” collection to the value of “Runtime” (you probably have “Developer” there).

If it’s not a Plugin, but basic UE4.17 asset, then this sounds like a bug!

Nope, not using any plugin there, it’s simple BPs, textures and meshes that aren’t found. I would appreciate if anybody from staff would look at it before I report this as a bug, I won’t want to file a bug report if I’m making a user error here, besides somebody else must be encountering the same problem if it is a bug.
I am sure there is a simple way to do this right, if only I could get somebody to look at this here who has solved the same problem or knows how to do it

Hey,

I opened a BR for a different problem, and finally figured out it was the same problem.

Here’s a working solution in C++ (see my final answer), but the code is very simple, you shouldn’t have too much difficulty to translate it into BP.

https://answers.unrealengine.com/questions/729231/requestasyncload-cant-find-assets-in-packaged-game.html

Hope this helps

Cheers

Cedric

yes, we have exactly the same problem, can’t solve for long time. my manager almost want to change to unity3d, for it has assetbundle can load anything from url or file.