4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AssetBundle.CreateFromFileのクラッシュ回避

Last updated at Posted at 2015-06-01

以下のコードでクラッシュした。

unityC#
string path = "hoge";
AssetBundle NoCompress = AssetBundle.CreateFromFile(path);

out of memoryが出てたのでそれ系の原因を探してたけど、全く別の原因だった。
原因は無圧縮を指定せずにアセットバンドルを作成したことだった。

解決法:

アセットバンドルを作るときに

unityC#
BuildPipeline.BuildAssetBundles(OutPutPath, BuildAssetBundleOptions.UncompressedAssetBundle, EditorUserBuildSettings.activeBuildTarget);

こんな感じで、第二引数に
BuildAssetBundleOptions.UncompressedAssetBundleを指定してやる。

参考:
http://docs.unity3d.com/ScriptReference/AssetBundle.CreateFromFile.html

追記:
エラーや例外返すんじゃなくてクラッシュするのどうにかしれ('A`)

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?