AddressableでアセットをInstantiateしたらピンクになった時の対処法

Unity

Unity開発3大バグのうちの一つ、ピンクマテリアルですね…見るたびオエエエってなります。

Unity2019.3.0b1, UWP環境です。

スポンサーリンク

原因

結論だけ言うとDependency関係にあるMaterialが読み込まれてません

対策

        _handle = Addressables.LoadAssetAsync<GameObject>("cube");
        _dependency = Addressables.DownloadDependenciesAsync("cube");

こんな感じで両方待つようにしたら正常に表示されました。

しかしこれが正解なのかよくわかってません。LoadAssetAsyncで依存関係も含め全部ロードしてくれればいいような気がするんですが

GitHub - Unity-Technologies/Addressables-Sample: Demo project using Addressables package
Demo project using Addressables package. Contribute to Unity-Technologies/Addressables-Sample development by creating an account on GitHub.

こちらのサンプルはLegacy pipelineなんですが、特にDependency対策してなさそうでした。UWPが悪いのか、key指定のLoadAssetAsyncの仕様なのか…