概要
Addressable Asset System で Play Mode Script を
「Use Existing Build」にしている状態で Unity を再生した時に
Player content must be built before entering play mode with packed data. This can be done from the Addressables window in the Build->Build Player Content menu command.
上記のエラーが出て Unity が再生できない場合は
Addressables Groups ウィンドウの「Build > New Build > Default Build Script」を押して
アセットバンドルをビルドする
これで、Unity を正常に再生できるようになる
おまけ
アセットバンドルをビルドすると、
【Unity プロジェクト】\Library\com.unity.addressables\StreamingAssetsCopy\aa\【プラットフォーム名】\
上記のフォルダに
- catalog.json
- link.xml
- settings.json
が出力されるが、この内の「settings.json」が存在しない場合に
前述のエラーが発生する仕組みになっている
protected override TResult BuildDataImplementation<TResult>(AddressablesDataBuilderInput builderInput) { var timer = new System.Diagnostics.Stopwatch(); timer.Start(); var settingsPath = Addressables.BuildPath + "/settings.json"; if (!File.Exists(settingsPath)) { IDataBuilderResult resE = new AddressablesPlayModeBuildResult() { Error = "Player content must be built before entering play mode with packed data. This can be done from the Addressables window in the Build->Build Player Content menu command." }; return (TResult)resE; }