Difference between revisions of "Bundle Protocol"
From PowerUI
(Created page with "bundle:// is a slightly unusual protocol ''(you'll immediately see why)'' but it's useful none the less. It's used to obtain content from within an AssetBundle: <syntaxhighl...") |
|||
Line 9: | Line 9: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | You first specify the full path to the bundle and then the name of the asset inside it that you want as the hash. PowerUI internally handles downloading, loading up and then discovering the asset for you, in one easy to write line. | + | You first specify the full path to the bundle and then the name of the asset inside it that you want as the hash. PowerUI internally handles downloading, loading up and then discovering the asset for you, in one easy to write line. This will work over any protocol that responds with bytes. |
== The AssetBundle Lookup == | == The AssetBundle Lookup == |
Latest revision as of 21:16, 13 January 2017
bundle:// is a slightly unusual protocol (you'll immediately see why) but it's useful none the less. It's used to obtain content from within an AssetBundle:
<!-- An example of an asset called 'assetName' inside a bundle from the web -->
<img src='bundle://https://yoursite.com/bundle.assetbundle#assetName'>
You first specify the full path to the bundle and then the name of the asset inside it that you want as the hash. PowerUI internally handles downloading, loading up and then discovering the asset for you, in one easy to write line. This will work over any protocol that responds with bytes.
The AssetBundle Lookup
PowerUI will not download bundles repeatedly. Instead, it caches bundles by their URL. If multiple files are contained within the same bundle, it will ensure it's loaded just the once. If you would like to access those cached bundles, you can do so using the Bundles class:
AssetBundle bundle = PowerUI.Bundles.Get("https://yoursite.com/bundle.assetbundle");
// Null if not loaded