Why is using a Soft Reference from an actor in Blueprints still loading everything in memory in the Editor (according to the Size Map). Am I missing something?

Hello everyone,

I’ve noticed that the Size Maps of my actors are still indicating big amount of memory being used in the Editor even though I’m mostly using Soft References, Async loading/Loading and casting from the loaded assets.

For example, when I create a variable (Soft object) in an actor and don’t do anything with it, I still see the Size Map referencing a lot of things from the Actor used in the variable. I thought that this would only be loaded into memory when I call a Loading Asset node.

I understand that I can make a really light parent class for BP and use them for the Soft Refenrece in order to load less but at some point, I’m always supposed to load the assets to retrieve their variables.

Am I missing something or misunderstanding the concept?

I 'm using UE5.

I’m still learning on the topic so I might have misunderstood something! I’m curious.

Thanks in advance!

1 Like

Hey @Derelicts_Romain,
They are made to keep references to objects or assets that may not exist and reference assets without loading them. Soft object variables also won’t create hard references to the blueprint. While normally object references would throw errors if you would delete assets and don’t fix references, you might be damaging the Blueprint files. In technical terms, they hold the path to the object or asset, in a similar way as INI config or data tables.

The blueprint will auto-cast to object reference if you want to call a function on an asset or send it when a used asset will be automatically loaded. If an object doesn’t exist the cast would return null, but you can check validity beforehand too.

Aside from referencing assets that may not exist at runtime, one of many possible reasons is to reference an asset without loading it when it’s not really needed. You can reference objects on the level, without them needing to be loaded. You can make soft references and set actors on the level as default.

In short, they have a pretty specific use. Say you want an inventory system, but only want specific qualities from these objects loaded without actually loading the full object, or even the full system, this is when you’d want to soft reference.

I found an article from a previous thread if you’d like some more insight, too:

I hope some of this can help!
-Zen :vulcan_salute:

1 Like

Hello Zen,

Thank you for taking the time to reply.
Sorry, I might not have been clear in my message but I do understand what Soft References are and their purpose.

What I don’t understand is why my assets are still loaded in memory in my Editor (according to Size Maps from actors) even though I’m using Soft References.

For example, let’s say I make a Test Actor (empty) and only add a variable that references another Actor called “Normal Item” (much more complex actor) and makes this variable soft.

When I look at the Size Map of my “Test Actor”, it seems like it’s hard referencing the Normal Item actor because I have a huge memory indicated :

But I thought that my variable wouldn’t load anything up until I did the “Loading Asset” myself (meaning it would load this when I decide at runtime).

Am I missing something?

2 Likes

I’m wondering if this is a bug in 5. I see examples online of people using soft object/class refs in BP and the change is reflected in the size map and the reference viewer. But not so in 5.

( I don’t have a copy of 4 to check ).

Update: Use an actor type reference, but then in the details, you can set the target class without the BP loading anything.

2 Likes

Interesting! Thank you for checking this out ClockworkOcean.
I’ve asked another developer working with UE and he told me that he thought maybe the Size Map is not really reliable in Editor as the editor is already loading everything into memory.

I don’t know if that would makes sense or not!

I’ve seen people on utube change to a soft ref and the size map updates. ( pretty sure ). Also you get pink lines in the reference viewer. ( also doesn’t work ).

1 Like

Yeah, for me, the Size Map definitely updates when I use for example a Data Table with Soft Ref vs Hard Ref (but for things like Static Meshes, Textures, not actors).

But in the case of the variable with the actor, nothing changes, which is really weird…

Indeed, it’s the same for the Reference Viewer. My pins are red for the variables from the Data Table (the soft ref of static meshes) but for the variable of the actor, it’s still indicated as hard.

3 Likes

Do you have UE4? I can’t be bothered to download it and try :joy:

Hey ClockworkOcean!

So I tried the same test in Unreal Engine 4 and get the same behavior. Everything is loaded as soon as I create a Soft ref variable from another actor, according to the Size Map.

I’m guessing this is the normal way UE is loading it!

1 Like

Bizarre… :stuck_out_tongue_closed_eyes:

Hi - update on this, it DOES work, as long as you don’t use soft class variables.

If you put the class directly into the ‘load asset’ call, it doesn’t affect the BP size:

3 Likes

Nice! Thank you for getting back to me with this, @ClockworkOcean!

I set your answer as the solution of this thread. Have a nice weekend. :slight_smile:

1 Like

:smiley:

Apologies for the light necro, but I am finding myself looking into this too. I’ve found this post and this other post that all point to the same conclusion; adding a class soft reference variable seems to load the class into memory.

I’m writing this partially to express surprise as it seems counter to the whole purpose of soft references, but also a realisation that so long your soft reference type is of a lighter base class, this is perhaps not so much of an issue. For instance, you could make the variable of type ‘actor soft-ref’, which casts a very wide net but also doesn’t load anything new.

E.g. I had a blueprint class ‘Banana’ I filled with some static meshes and skeletal meshes. In a new BP I had a ‘Banana’ class soft ref, and using the console command memreport -full I confirmed it was indeed loaded into memory (even after restarting)

Then, I changed the variable type to an Actor soft ref, but set its value to ‘banana’, and restarted the editor. I opened the BP with the variable in it, to ensure that BP was loaded, then the same console command created a memory report with no mention of the ‘banana’ class in it.

NB. I got that memreport console command from this Epic dev blog post on memory debugging: Debugging and Optimizing Memory (unrealengine.com)

2 Likes

Just create a FruitBase abstract class that inherits from Actor class and set it as parent to the Banana, Apple, Pear, etc class.

That’s right, an actor type soft ref doesn’t load.

1 Like

just confirmed this as well on my end. it has to be a bug though, the whole idea of using soft references is to not load the assets into memory… ?

4 Likes


its right it works when you do a lighter base class, what I call generic, or at least it works for me, thanks

1 Like

I have noticed that once a soft reference gets loaded in the editor it will be loaded until the engine closes. That can be the reason why the soft reference is shown in the size map.

1 Like

This works for me! In my project, I have my BPs like so:

Pawn > GenericMechanism > Mechanism > ExampleCannonMechanism

I soft class reference GenericMechanism. It’s an empty BP. I mark it and Mechanism as abstract so they can’t be referenced.