Why is my soft object reference valid, even if I never loaded it?

Hello,

I made a BP with a soft object reference variable to a skeletal mesh with a default value. If I resolve it, it works. Thus it contains a valid object reference to an instanced object of the skeletal mesh. But I never loaded it (asynchronously or synchronously)! I thought the thing with soft object references is that they don’t automatically load, but that I can decide when they are loaded and unloaded?!

Thank you,

Thilo

edit: The bug has since disappeared for me since closing and reopening the editor. It’s working as intended now. The Skeletal Mesh isn’t getting loaded automatically.

I just tested this out with Skeletal Meshes and you are right, it gets loaded automatically. You can get around this bug/limitation by using Data Assets. You store a hard reference to the SkelMesh in a data asset, and you store a soft reference to the data asset. Load the data asset then get the skel mesh reference from it.

Quick tutorial on using Data Assets in BluePrint

  1. Create a New BP that inherits from Primary Data Asset. I’ll call this Skel_PDA
  2. Open Skel_PDA and add a Variable that is a Hard Obj Reference to a Skeletal Mesh. Compile and Save.
  3. Right Click in the Content Browser and go to Miscellaneous>Data Asset
  4. Choose Skel_PDA as the Data Asset Class. I’ll name this Skel_DA
  5. Open Skel_DA and set the Skeleton Mesh Obj variable to whatever you wish. You can create several of these DA the same way and give each one a different Skeleton Mesh.
  6. Now you can create a variable that is a Soft Obj Reference to type Skel_PDA and set it’s value to Skel_DA. Then you would Async Load that DataAsset and get the Skeleton Mesh from it.

I also wanted to add if anyone runs into this problem they should delete their Saved and Intermediate folders in their project folder, then package the game and see if it still happens.

1 Like

If you are testing this in editor, the asset will also be loaded when you open it’s asset editor or if you right click it.

So if you want to test this properly, ensure you restart the editor every time or test it in a a packaged version of you game.

1 Like