Download

How to create a reference to a skeletal mesh in the editor without loading it?

Hello,

I want to make a “skeletal mesh selection” as a property of a class (array), so that the user of the class can select which skeletal meshes the skeletal mesh component in the class can show - the skeletal mesh to show will be randomly picked from the array. This array can be quite big, hundreds of skeletal meshes, so I cannot just make an array of object references to the skeletal meshes since they are loaded then and to load hundreds of skeletal meshes to show one in the end is really a waste of resources. So I thought an array of soft object references would be the right thing for this, but they behave just like the normal object references and the skeletal meshes are automatically loaded when the class is loaded. Soft class references are not possible for skeletal meshes. So, object references, class references, soft object references and soft class references are not working. How to do this then?

Thank you,

Thilo

You’ll want to use a soft reference for this. Basically a path to the object in the asset registry rather than the object itself.

When you create a new variable, you have the option to choose a hard reference or a soft reference to objects (mouse over the right-facing arrow).

Then you can choose to load the object synchronously or asynchronously. Make sure you cast it after loading it.

You can also load a soft reference to a class instead if that’s how you’re storing your skeletal mesh information.

Additional resources:

https://docs.unrealengine.com/en-US/Programming/Assets/Registry/index.html

https://docs.unrealengine.com/en-US/Programming/Assets/ReferencingAssets/index.html

For some reason a Soft Object Reference to a Skeletal Mesh is loaded automatically like it was a Hard Reference. It must be a bug. I posted a solution using Data Assets in your other thread OP. Also I tested this in 4.24 and it is fixed (I’m still using 4.22.3 and the bug is present there)

edit: and now I can’t reproduce the bug. It stopped behaving this way after reloading the editor