Slow loading custom binary asset.

Hey everyone,

I have some binary data I need to work with in UE4 so I created a custom UObject for it and my own Import Factory. It’s pretty simple, when you import the asset it copies all the binary data into a TArray<uint8> in the custom UObject and then its parsed at runtime when it’s needed. This works fine however I’m noticing when I first open unreal editor and try to drag the asset to assign it if it hasn’t been used before there seems to be a delay in the drag of 3-4 seconds. I’m assuming this is because the asset isn’t loaded into memory until it actually has to be used and unreal is loading it from disk. After the first drag it’s responsive as expected from there.

My question is for large binary data like this is my approach the wrong one? If so is there a better approach to making binary data like this a part of the unreal editor ecosystem? Is there a way to do this asynchronously or perhaps have the editor preload the asset on open, etc?

Thanks in advance.

This sounds normal to me, especially for the editor. A big object that uses alot of memory (say a high quality mesh with 4k textures full pbr) might cause a delay when you 1st drag it into the viewport because it is not loaded. Unreal will only load items that are “in play” aka in the level. When you drag something into the level/viewport, it has to load everything 1st before it can create an instance of the object. The other option is to spawn the object during “run time” but you would get the same hitch i believe. you can also save your project with your item in the level then close and open the editor, the load hitch is now moved to the editor 1st loading your map/level.

The only other option is to do a pre-load using asynchronous asset loading…ing/index.html which will slow load the object (non blocking, but it takes longer).

But asynchronous loading wont work properly in PIE is my understanding, since it starts at game launch. So once you click play, asyncloading would then start at that point if you have it called somewhere (like in begin play in a class somewhere). (unless someone knows better than me a way to do it in pie, maybe its possible)

Other question, are you running a solid state hard drive?