Twoorb Plugins  1.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties
Twoorb.PrefabSystem.AssetBundleLoader Class Reference

AssetBundleLoader loads, unloads and keeps track of asset bundles and their dependencies More...

Public Member Functions

 AssetBundleLoader ()
 Creates a new asset bundle loader More...
 
void UnloadUnusedBundles ()
 Checks all the referenced asset bundles and their dependencies, unloading the ones that is not referenced by anything. More...
 
void UnloadUnusedDependencyBundles ()
 Checks all the rerefenced dependency bundles if they have anyone depending on them and unloads anyone with no dependencies. More...
 
void DownloadDependencyBundle (Action< bool > onDone, string bundleID, string url, int version, Hashtable formData)
 Downloads a dependency bundle with the specified parameters. If a download of the same bundle already is in progress, it will just wait for that one instead. More...
 
void GetInstantiatedPrefabObject (Action< GameObject > onDone, string bundleID, string url, string assetName, int version, Hashtable formData, bool hasDependencies, string dependencyBundle=null)
 Gets an instantiated prefab from a downloaded asset bundle. Will try and download the asset bundle if it's not already downloaded. More...
 
bool UnregisterInstantiatedObject (string bundleID, string assetName, GameObject instantiatedObject)
 Unregisters an instantiated object that was instantiated with the GetInstantiatedPrefabObject() method. More...
 

Detailed Description

AssetBundleLoader loads, unloads and keeps track of asset bundles and their dependencies

Constructor & Destructor Documentation

Twoorb.PrefabSystem.AssetBundleLoader.AssetBundleLoader ( )

Creates a new asset bundle loader

Member Function Documentation

void Twoorb.PrefabSystem.AssetBundleLoader.DownloadDependencyBundle ( Action< bool >  onDone,
string  bundleID,
string  url,
int  version,
Hashtable  formData 
)

Downloads a dependency bundle with the specified parameters. If a download of the same bundle already is in progress, it will just wait for that one instead.

Parameters
onDoneCallback for when the bundle is downloaded. Returns a bool indicating success or failure
bundleIDThe ID of the asset bundle
urlThe url to the asset bundle
versionThe version of the bundle to download
formDataForm data with headers to use in the WWW request. Can be null.
void Twoorb.PrefabSystem.AssetBundleLoader.GetInstantiatedPrefabObject ( Action< GameObject >  onDone,
string  bundleID,
string  url,
string  assetName,
int  version,
Hashtable  formData,
bool  hasDependencies,
string  dependencyBundle = null 
)

Gets an instantiated prefab from a downloaded asset bundle. Will try and download the asset bundle if it's not already downloaded.

Parameters
onDoneCallback returning the instantiated object. Will be null on failure
bundleIDThe ID of the bundle where the prefab resides
urlThe url to the bundle
assetNameThe name of the prefab to instantiate
versionThe version of the asset bundle
formDataForm data with headers to use in the WWW request. Can be null.
hasDependenciesIf the bundle has any other asset bundles they depend on to work
dependencyBundleThe name of the dependency bundle. Can be null if hasDependencies is false
void Twoorb.PrefabSystem.AssetBundleLoader.UnloadUnusedBundles ( )

Checks all the referenced asset bundles and their dependencies, unloading the ones that is not referenced by anything.

void Twoorb.PrefabSystem.AssetBundleLoader.UnloadUnusedDependencyBundles ( )

Checks all the rerefenced dependency bundles if they have anyone depending on them and unloads anyone with no dependencies.

bool Twoorb.PrefabSystem.AssetBundleLoader.UnregisterInstantiatedObject ( string  bundleID,
string  assetName,
GameObject  instantiatedObject 
)

Unregisters an instantiated object that was instantiated with the GetInstantiatedPrefabObject() method.

Parameters
bundleIDThe ID of the asset bundle where the prefab resides.
assetNameThe original name of the instantiated prefab.
instantiatedObjectThe instantiated object to unregister
Returns
If the operation was successful

The documentation for this class was generated from the following file: