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

Represents an Asset Loader class which works with Zip files. More...

Static Public Member Functions

static AssetLoaderContext LoadModelFromZipFile (string path, Action< AssetLoaderContext > onLoad, Action< AssetLoaderContext > onMaterialsLoad, Action< AssetLoaderContext, float > onProgress, Action< IContextualizedError > onError=null, GameObject wrapperGameObject=null, AssetLoaderOptions assetLoaderOptions=null, object customContextData=null, string fileExtension=null, bool haltTask=false, Action< AssetLoaderContext > onPreLoad=null)
 Loads a model from the given Zip file path asynchronously.
 
static AssetLoaderContext LoadModelFromZipStream (Stream stream, Action< AssetLoaderContext > onLoad, Action< AssetLoaderContext > onMaterialsLoad, Action< AssetLoaderContext, float > onProgress, Action< IContextualizedError > onError=null, GameObject wrapperGameObject=null, AssetLoaderOptions assetLoaderOptions=null, object customContextData=null, string fileExtension=null, bool haltTask=false, string modelFilename=null, Action< AssetLoaderContext > onPreLoad=null)
 Loads a model from the given Zip file Stream asynchronously.
 
static AssetLoaderContext LoadModelFromZipFileNoThread (string path, Action< IContextualizedError > onError=null, GameObject wrapperGameObject=null, AssetLoaderOptions assetLoaderOptions=null, object customContextData=null, string fileExtension=null)
 Loads a model from the given Zip file path synchronously.
 
static AssetLoaderContext LoadModelFromZipStreamNoThread (Stream stream, Action< IContextualizedError > onError, GameObject wrapperGameObject=null, AssetLoaderOptions assetLoaderOptions=null, object customContextData=null, string fileExtension=null)
 Loads a model from the given Zip file Stream synchronously.
 
static Stream ZipFileEntryToStream (out string fileExtension, ZipEntry zipEntry, ZipFile zipFile)
 Copies the contents of a Zip file Entry into a Memory Stream.
 

Detailed Description

Represents an Asset Loader class which works with Zip files.

Member Function Documentation

◆ LoadModelFromZipFile()

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

Loads a model from the given Zip file path asynchronously.

Parameters
pathThe Zip 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.
fileExtensionThe Model inside the Zip file extension. If null TriLib will try to find a suitable model format inside the Zip file.
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.
Returns
The asset loader context, containing model loading information and the output game object.

◆ LoadModelFromZipFileNoThread()

static AssetLoaderContext TriLibCore.AssetLoaderZip.LoadModelFromZipFileNoThread ( string  path,
Action< IContextualizedError onError = null,
GameObject  wrapperGameObject = null,
AssetLoaderOptions  assetLoaderOptions = null,
object  customContextData = null,
string  fileExtension = null 
)
static

Loads a model from the given Zip file path synchronously.

Parameters
pathThe Zip 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.
fileExtensionThe Model inside the Zip file extension. If null TriLib will try to find a suitable model format inside the Zip file.
Returns
The asset loader context, containing model loading information and the output game object.

◆ LoadModelFromZipStream()

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

Loads a model from the given Zip file Stream asynchronously.

Parameters
streamThe Stream containing the Zip data.
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.
fileExtensionThe Model inside the Zip file extension. If null TriLib will try to find a suitable model format inside the Zip file.
haltTaskTurn on this field to avoid loading the model immediately and chain the Tasks.

///

Parameters
modelFilenameThe Zip file path.
onPreLoadThe method to call on the parallel Thread before the Unity objects are created.
Returns
The asset loader context, containing model loading information and the output game object.

◆ LoadModelFromZipStreamNoThread()

static AssetLoaderContext TriLibCore.AssetLoaderZip.LoadModelFromZipStreamNoThread ( Stream  stream,
Action< IContextualizedError onError,
GameObject  wrapperGameObject = null,
AssetLoaderOptions  assetLoaderOptions = null,
object  customContextData = null,
string  fileExtension = null 
)
static

Loads a model from the given Zip file Stream synchronously.

Parameters
streamThe Stream containing the Zip data.
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.
fileExtensionThe Model inside the Zip file extension. If null TriLib will try to find a suitable model format inside the Zip file.
Returns
The asset loader context, containing model loading information and the output game object.

◆ ZipFileEntryToStream()

static Stream TriLibCore.AssetLoaderZip.ZipFileEntryToStream ( out string  fileExtension,
ZipEntry  zipEntry,
ZipFile  zipFile 
)
static

Copies the contents of a Zip file Entry into a Memory Stream.

Parameters
fileExtensionThe Model inside the Zip file extension.
zipEntryThe Zip file Entry.
zipFileThe Zip file instance.
Returns
A memory stream with the zip file entry contents.