Optimization

About

With the various exposed parameters in the Prefab Reference Component and Runtime Project Settings you can optimize how are spawned your prefab actors.

The main optimization methods that avoid hitches are asynchronous load and time slicing.

Asynchronous Load

By asynchronous load I mean asynchronously loading the prefab actor class using the AsyncLoadActorPrefabSpawnParameters in the Spawn Parameters array.

Time Slicing

By time slicing I mean batching spawn request over multiple frames if to many prefab actors are spawned in one frame.

The general time slicing parameters can be found in the Project Settings, as for 1.0.2 the following are available:

You can enable/disable time slicing on a per PRC biasis to.

Detailed explanation for each parameter can be found in the tooltip and source code.

Here is a concrete example

When the player walks on the golden plate, 1000 spawn request are made. (The spawned prefabs are spawned as a "grid" for better visualization, 100 actors per "column").

With time slicing DISABLED:

As you can see on the video, there is a big FPS drop when the 500 actors are spawned withing 1 frame.

Here is the profiler result: 725ms were taken to render the frame, which means a drop to less than 2 FPS.

With time slicing ENABLED:

As you can see on the video, the prefab actors are spawned over time and there is no FPS drop.

If you play with the parameters or other effects (such as a loading screen) you can make the deferred spawning less noticeable.

It is hard to see on the profiler but the spawning process was run at the given internal for the given allocated budget time.

Last updated