0

I'm trying to undestand when and in which thread Unreal loading assets of Actors. I have Spawner that call's SpawnActor for different actors (which have Meshes, Sounds, etc) in the game thread in runtime. As I understood Unreal loads that assets when first object containing it was spawned. So, it reads data from filesystem which can take a long time. Will it freeze the Game Thread? Does Unread load it in separate thread to prevent Game Thread freezing?

If freezing of Game Thread is possible, what can I do to prevent it? Should I create all actors in Spawner after load and then just clone it in runtime?

Robotex
  • 1,064
  • 6
  • 17
  • 41
  • 1
    Unreal loads assets as soon as they're hard refernced (by a UPROPERTY pointer or any non-soft refernce in blueprint). There is functionality for loading assets asynchronously at runtime (via soft refernces) - [doc](https://docs.unrealengine.com/4.27/en-US/ProgrammingAndScripting/ProgrammingWithCPP/Assets/AsyncLoading/). Which won't stall the main thread. One thing to watch out for is that sync loading will generally flush async load tasks, stalling the main thread for an extended period of time. ConstructorHelpers::FObjectFinder is a sneaky the engine can cause a sync load. – George Mar 26 '22 at 06:49
  • "Unreal loads assets as soon as they're hard refernced" - in which threat does it do? – Robotex Mar 28 '22 at 09:47

0 Answers0