Model Loading Flow

De TriLib
Ir para navegação Ir para pesquisar

TriLib asynchronous loading is divided across three Threads.

The first parallel Thread parses all original Model data using the format TriLib will use to create Unity objects later.

Embedded Textures data are loaded in this Thread, along with original Texture filenames.


The main Thread processes the data from the first parallel Thread and creates Unity Game Objects, Meshes, Animation Clips.

It will then trigger the OnLoad method before creating the Textures and dispatching the Textures data parsing/loading process in the second parallel Thread.


The second parallel Thread transforms the Textures embedded data into Unity Textures data or tries to load the Textures data from disk or any custom data source when there is no embedded Texture data.

This Thread will then trigger the OnMaterialsLoad method on the main Thread.


If there is a loading timeout or any error is thrown at any given time, the OnError method followed by the OnLoad and the OnMaterialsLoad method will be triggered on the main Thread.

This allows developers to handle partially loaded Models.


The synchronous loading follows the same rules, but with all tasks done in the main Thread.