Loading problem with TSoftObjectPtr

There are three actors

There is an array TSoftObjectPtr for them in the properties
image

CPP has made the functionality of selecting a random mesh for each actor individually
image

The problem is that when entering the game not all mesh are loaded
image

Here’s the code
image

Help, please, thank you in advance

Hey blAddddDe,
From what I see you are loading the soft object only if it’s valid, but if it’s not valid nothing is loading it. You should load the asset if it’s not valid instead. Maybe the other assets are working because they are hard referenced somewhere or you have opened them in the editor causing them to be loaded in memory.
Check this documentation article to learn more about the argument: Asynchronous Asset Loading in Unreal Engine | Unreal Engine 5.3 Documentation

1 Like

So what should be used instead of IsValid.
IsNull / IsPending or nothing at all?

IsValid is correct.

Absence of if !IsValid() { Load } is incorrect.

So I Need to check ‘’‘!IsValid()’‘’ instead of ‘’‘isValid()’‘’

Correct

IsPending is what you should use before loading otherwise you might attempt to load “nothing”.

I just removed that condition

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.