AssetBundle と利用すると WWW クラスによって追加のアセットをストリーミングし、ランタイムでインスタンス化することができます。 AssetBundle は BuildPipeline.BuildAssetBundle によって作成されます。
Note that bundles are not compatible between platforms. A bundle built for any of the standalone
platforms can only be loaded on that platform but not others.
Further example, a bundle built for iOS is not compatible with Android and vice versa. One difference
is shaders which are different between devices, as are textures.
See Also: WWW.assetBundle, Loading Resources at Runtime, BuildPipeline.BuildAssetBundle.
using System; using System.Collections; using UnityEngine;
public class SampleBehaviour : MonoBehaviour { IEnumerator Start() { WWW www = new WWW("http://myserver/myBundle.unity3d"); yield return www;
// Get the designated main asset and instantiate it. Instantiate(www.assetBundle.mainAsset); } }
| isStreamedSceneAssetBundle | アセットバンドルがストリーミングされたシーンのアセットバンドルならば、true を返します。 |
| mainAsset | アセットバンドルをビルドするときに、必ず使うアセットを設定します(読み取り専用) |
| Contains | 特定のオブジェクトがアセットバンドルに含まれているか確認します。 |
| GetAllAssetNames | アセットバンドルにあるすべてのアセット名を返します。 |
| GetAllScenePaths | アセットバンドルにあるすべてのシーンアセットのパス( *.unity アセットへのパス)を返します。 |
| LoadAllAssets | 型から継承したアセットバンドルに含まれるすべてのアセットを読み込みます。 |
| LoadAllAssetsAsync | アセットバンドルに含まれるすべてのアセットを非同期で読み込みます。 |
| LoadAsset | アセットバンドルから指定する name のアセットを読み込みます。 |
| LoadAssetAsync | 非同期でアセットバンドルから name のアセットを読み込みます。 |
| LoadAssetWithSubAssets | name のアセットとサブアセットをアセットバンドルから読み込みます。 |
| LoadAssetWithSubAssetsAsync | name のアセットとサブアセットを非同期でアセットバンドルから読み込みます。 |
| Unload | バンドル内のすべてのアセットをアンロードします。 |
| GetAllLoadedAssetBundles | To use when you need to get a list of all the currently loaded Asset Bundles. |
| LoadFromFile | ディスクから同期でアセットバンドルを読み込みます。 |
| LoadFromFileAsync | ディスクから非同期でアセットバンドルを読み込みます。 |
| LoadFromMemory | 同期メモリ領域からアセットバンドルを作成します。 |
| LoadFromMemoryAsync | 非同期メモリ領域からアセットバンドルを作成します。 |
| LoadFromStream | Synchronously loads an AssetBundle from a managed Stream. |
| LoadFromStreamAsync | Asynchronously loads an AssetBundle from a managed Stream. |
| UnloadAllAssetBundles | Unloads all currently loaded Asset Bundles. |
| GetInstanceID | オブジェクトのインスタンス ID を返します |
| ToString | ゲームオブジェクトの名前を返します |
| Destroy | ゲームオブジェクトやコンポーネント、アセットを削除します |
| DestroyImmediate | Destroys the object obj immediately. You are strongly recommended to use Destroy instead. |
| DontDestroyOnLoad | 新しいシーンを読み込んでもオブジェクトが自動で破壊されないように設定します |
| FindObjectOfType | タイプ type から最初に見つけたアクティブのオブジェクトを返します |
| FindObjectsOfType | タイプから見つけたすべてのアクティブのオブジェクト配列を返します |
| Instantiate | original のオブジェクトをクローンします |
| bool | オブジェクトが存在するかどうか |
| operator != | 二つのオブジェクトが異なるオブジェクトを参照しているか比較します |
| operator == | 2つのオブジェクト参照が同じオブジェクトを参照しているか比較します。 |