TriLib 2.2.8
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
TriLibCore.AssetLoader Class Reference

Represents the main class containing methods to load the Models. More...

Static Public Member Functions

static AssetLoaderContext LoadModelFromFile (string path, Action< AssetLoaderContext > onLoad=null, Action< AssetLoaderContext > onMaterialsLoad=null, Action< AssetLoaderContext, float > onProgress=null, Action< IContextualizedError > onError=null, GameObject wrapperGameObject=null, AssetLoaderOptions assetLoaderOptions=null, object customContextData=null, bool haltTask=false, Action< AssetLoaderContext > onPreLoad=null, bool isZipFile=false)
 Loads a Model from the given path asynchronously.
 
static AssetLoaderContext LoadModelFromStream (Stream stream, string filename=null, string fileExtension=null, Action< AssetLoaderContext > onLoad=null, Action< AssetLoaderContext > onMaterialsLoad=null, Action< AssetLoaderContext, float > onProgress=null, Action< IContextualizedError > onError=null, GameObject wrapperGameObject=null, AssetLoaderOptions assetLoaderOptions=null, object customContextData=null, bool haltTask=false, Action< AssetLoaderContext > onPreLoad=null, bool isZipFile=false)
 Loads a Model from the given Stream asynchronously.
 
static AssetLoaderContext LoadModelFromFileNoThread (string path, Action< IContextualizedError > onError=null, GameObject wrapperGameObject=null, AssetLoaderOptions assetLoaderOptions=null, object customContextData=null, bool isZipFile=false)
 Loads a Model from the given path synchronously.
 
static AssetLoaderContext LoadModelFromStreamNoThread (Stream stream, string filename=null, string fileExtension=null, Action< IContextualizedError > onError=null, GameObject wrapperGameObject=null, AssetLoaderOptions assetLoaderOptions=null, object customContextData=null, bool isZipFile=false)
 Loads a Model from the given Stream synchronously.
 
static AssetLoaderOptions CreateDefaultLoaderOptions (bool generateAssets=false, bool supressWarning=false)
 Creates an Asset Loader Options with the default settings and Mappers.
 

Detailed Description

Represents the main class containing methods to load the Models.

Member Function Documentation

◆ CreateDefaultLoaderOptions()

static AssetLoaderOptions TriLibCore.AssetLoader.CreateDefaultLoaderOptions ( bool  generateAssets = false,
bool  supressWarning = false 
)
static

Creates an Asset Loader Options with the default settings and Mappers.

Parameters
generateAssetsIndicates whether created Scriptable Objects will be saved as assets.
supressWarningPass trueif you are caching your AssetLoaderOptions instance.
Returns
The Asset Loader Options containing the default settings.

◆ LoadModelFromFile()

static AssetLoaderContext TriLibCore.AssetLoader.LoadModelFromFile ( string  path,
Action< AssetLoaderContext onLoad = null,
Action< AssetLoaderContext onMaterialsLoad = null,
Action< AssetLoaderContext, float >  onProgress = null,
Action< IContextualizedError onError = null,
GameObject  wrapperGameObject = null,
AssetLoaderOptions  assetLoaderOptions = null,
object  customContextData = null,
bool  haltTask = false,
Action< AssetLoaderContext onPreLoad = null,
bool  isZipFile = false 
)
static

Loads a Model from the given path asynchronously.

Parameters
pathThe Model file path.
onLoadThe Method to call on the Main Thread when the Model is loaded but resources may still pending.
onMaterialsLoadThe Method to call on the Main Thread when the Model and resources are loaded.
onProgressThe Method to call when the Model loading progress changes.
onErrorThe Method to call on the Main Thread when any error occurs.
wrapperGameObjectThe Game Object that will be the parent of the loaded Game Object. Can be null.
assetLoaderOptionsThe options to use when loading the Model.
customContextDataThe Custom Data that will be passed along the Context.
haltTaskTurn on this field to avoid loading the model immediately and chain the Tasks.
onPreLoadThe method to call on the parallel Thread before the Unity objects are created.
isZipFileIndicates whether to load from a Zip file.
Returns
The Asset Loader Context, containing Model loading information and the output Game Object.

◆ LoadModelFromFileNoThread()

static AssetLoaderContext TriLibCore.AssetLoader.LoadModelFromFileNoThread ( string  path,
Action< IContextualizedError onError = null,
GameObject  wrapperGameObject = null,
AssetLoaderOptions  assetLoaderOptions = null,
object  customContextData = null,
bool  isZipFile = false 
)
static

Loads a Model from the given path synchronously.

Parameters
pathThe Model file path.
onErrorThe Method to call on the Main Thread when any error occurs.
wrapperGameObjectThe Game Object that will be the parent of the loaded Game Object. Can be null.
assetLoaderOptionsThe options to use when loading the Model.
customContextDataThe Custom Data that will be passed along the Context.
isZipFileIndicates whether to load from a Zip file.
Returns
The Asset Loader Context, containing Model loading information and the output Game Object.

◆ LoadModelFromStream()

static AssetLoaderContext TriLibCore.AssetLoader.LoadModelFromStream ( Stream  stream,
string  filename = null,
string  fileExtension = null,
Action< AssetLoaderContext onLoad = null,
Action< AssetLoaderContext onMaterialsLoad = null,
Action< AssetLoaderContext, float >  onProgress = null,
Action< IContextualizedError onError = null,
GameObject  wrapperGameObject = null,
AssetLoaderOptions  assetLoaderOptions = null,
object  customContextData = null,
bool  haltTask = false,
Action< AssetLoaderContext onPreLoad = null,
bool  isZipFile = false 
)
static

Loads a Model from the given Stream asynchronously.

Parameters
streamThe Stream containing the Model data.
filenameThe Model filename.
fileExtensionThe Model file extension. (Eg.: fbx)
onLoadThe Method to call on the Main Thread when the Model is loaded but resources may still pending.
onMaterialsLoadThe Method to call on the Main Thread when the Model and resources are loaded.
onProgressThe Method to call when the Model loading progress changes.
onErrorThe Method to call on the Main Thread when any error occurs.
wrapperGameObjectThe Game Object that will be the parent of the loaded Game Object. Can be null.
assetLoaderOptionsThe options to use when loading the Model.
customContextDataThe Custom Data that will be passed along the Context.
haltTaskTurn on this field to avoid loading the model immediately and chain the Tasks.
onPreLoadThe method to call on the parallel Thread before the Unity objects are created.
isZipFileIndicates whether to load from a Zip file.
Returns
The Asset Loader Context, containing Model loading information and the output Game Object.

◆ LoadModelFromStreamNoThread()

static AssetLoaderContext TriLibCore.AssetLoader.LoadModelFromStreamNoThread ( Stream  stream,
string  filename = null,
string  fileExtension = null,
Action< IContextualizedError onError = null,
GameObject  wrapperGameObject = null,
AssetLoaderOptions  assetLoaderOptions = null,
object  customContextData = null,
bool  isZipFile = false 
)
static

Loads a Model from the given Stream synchronously.

Parameters
streamThe Stream containing the Model data.
filenameThe Model filename.
fileExtensionThe Model file extension. (Eg.: fbx)
onErrorThe Method to call on the Main Thread when any error occurs.
wrapperGameObjectThe Game Object that will be the parent of the loaded Game Object. Can be null.
assetLoaderOptionsThe options to use when loading the Model.
customContextDataThe Custom Data that will be passed along the Context.
isZipFileIndicates whether to load from a Zip file.
Returns
The Asset Loader Context, containing Model loading information and the output Game Object.