Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
Close最初のステップはバイナリデータを“.bytes” 拡張子で保存することです。Unityは TextAsset (テキストアセット)としてファイルを取り扱います。テキストアセットの場合,ファイルはAssetBundle(アセットバンドル)をビルドするときにincludeすることが出来ます。アセットバンドルをアプリケーションにダウンロードして,テキストアセット オブジェクトをロードした後,テキストアセットの.bytes プロパティを使用してバイナリデータを取得することが出来ます。
string url = "http://www.mywebsite.com/mygame/assetbundles/assetbundle1.unity3d";
IEnumerator Start () {
// Start a download of the given URL
WWW www = WWW.LoadFromCacheOrDownload (url, 1);
// Wait for download to complete
yield return www;
// Load and retrieve the AssetBundle
AssetBundle bundle = www.assetBundle;
// Load the TextAsset object
TextAsset txt = bundle.Load("myBinaryAsText", typeof(TextAsset)) as TextAsset;
// Retrieve the binary data as an array of bytes
byte[] bytes = txt.bytes;
}