Defer Agents
When loading glTFs, glTFast let's you optimize towards one of two diametrical goals
A stable frame rate
Fastest loading time
By default each GltfAsset instance tries not to block the main thread for longer than a certain time budget and defer the remaining loading process to the next frame / game loop iteration.
If you load many glTF files at once, by default they won't be aware of each other and collectively might block the main game loop for too long.
You can solve this by using a "defer agent". It decides if work should continue right now or at the next game loop iteration. glTFast comes with two defer agents
TimeBudgetPerFrameDeferAgentfor stable frame rateUninterruptedDeferAgentfor fastest, uninterrupted loading
If no defer agent is specified, default defer agent is set to UninterruptedDeferAgent.
To Set A Defer Agent
We provide a prefab for setting the
TimeBudgetPerFrameDeferAgent, you can find it inPackages/Ready Player Me Core/Runtime/Core/Prefabsfolder.

This can then be referenced in GLTF defer agent field in settings.

Custom Defer Agent
A custom defer agent can be created by implementing IDeferAgent provided by glTFast. To use it with Ready Player Me, attach a DeferAgent component to the gameObject and reference the gameObject in the settings menu.
public class CustomDeferAgent: MonoBehaviour, IDeferAgent
{
public bool ShouldDefer()
{
return false;
}
public bool ShouldDefer(float duration)
{
return false;
}
public Task BreakPoint()
{
return null;
}
public Task BreakPoint(float duration)
{
return null;
}
}Last updated
Was this helpful?

