TriLib 2.3.8
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | List of all members
TriLibCore.AssetDownloader Class Reference

Represents a class to download and load Models. More...

Public Types

enum  HttpRequestMethod {
  Get , Post , Put , Delete ,
  Head
}
 Represents an HTTP Request method. More...
 

Static Public Member Functions

static UnityWebRequest CreateWebRequest (string uri, HttpRequestMethod httpRequestMethod=HttpRequestMethod.Get, string data=null, int timeout=2000)
 Creates a Unity Web Request from the given parameters.
 
static Coroutine LoadModelFromUri (UnityWebRequest unityWebRequest, 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? isZipFile=null, bool haltTask=false)
 Loads a Model from the given URI Asynchronously (Accepts zip files).
 

Detailed Description

Represents a class to download and load Models.

Member Enumeration Documentation

◆ HttpRequestMethod

Represents an HTTP Request method.

Enumerator
Get 

The HTTP GET method.

Post 

The HTTP POST method.

Put 

The HTTP PUT method.

Delete 

The HTTP DELETE method.

Head 

The HTTP HEAD method.

Member Function Documentation

◆ CreateWebRequest()

static UnityWebRequest TriLibCore.AssetDownloader.CreateWebRequest ( string  uri,
HttpRequestMethod  httpRequestMethod = HttpRequestMethod::Get,
string  data = null,
int  timeout = 2000 
)
static

Creates a Unity Web Request from the given parameters.

Parameters
uriThe Request URI (URL).
httpRequestMethodThe HTTP Request method to use.
dataThe Custom Data that was sent along the Request.
timeoutThe Request timeout in seconds).
Returns
The created unity web request.

◆ LoadModelFromUri()

static Coroutine TriLibCore.AssetDownloader.LoadModelFromUri ( UnityWebRequest  unityWebRequest,
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?  isZipFile = null,
bool  haltTask = false 
)
static

Loads a Model from the given URI Asynchronously (Accepts zip files).

Parameters
unityWebRequestThe Unity Web Request used to load the Model. You can use the CreateWebRequest method to create a new Unity Web Request or pass your instance.
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 extension of the URI Model or the Model inside the Zip file.
isZipFilePass true if your file is a Zip file.
haltTaskTurn on this field to avoid loading the model immediately and chain the Tasks.
Returns
The AssetLoaderContext used to load the model.