facebook twitter hatena line email

「Unity/CloudBuild」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(Addressable Asset ビルド)
(同じ利用者による、間の29版が非表示)
行1: 行1:
 +
==はじめに==
 +
よくある質問(英語):https://support.unity.com/hc/en-us/sections/201104819-Cloud-Build?_gl=1*89opoe*_ga*MTYzNjU3Mjc4NC4xNjE4ODExNzMy*_ga_1S78EFL1W5*MTYyNzg5MzkyOC4zNC4xLjE2Mjc4OTQ5NTkuMjU.&_ga=2.79763159.1135166697.1627891755-1636572784.1618811732&_gac=1.28853966.1626162759.CjwKCAjw87SHBhBiEiwAukSeURvXkmTwL_Hy5QAyIJIutPXXdinFrv-7oSTy6jvoz5n8HH0ExPg6EBoCP2sQAvD_BwE
 +
 +
CloudBuildはなぜ遅いのか:https://support.unity.com/hc/en-us/articles/205215503-Why-are-my-build-times-on-Cloud-Build-taking-so-long-
 +
 
==CloudBuildをOnへ==
 
==CloudBuildをOnへ==
 
window/General/Services/CloudBuildをonへ
 
window/General/Services/CloudBuildをonへ
行51: 行56:
  
 
==WebGLプラットフォームについて==
 
==WebGLプラットフォームについて==
 +
===応用設定===
 +
公式:
 +
https://docs.unity3d.com/ja/2019.4/Manual/UnityCloudBuildAdvancedOptions.html
 +
 
===Asset Bundleビルド===
 
===Asset Bundleビルド===
 
# ConfigのAsset Bundle Optionsを選択
 
# ConfigのAsset Bundle Optionsを選択
 
# "Yes, I'd like to build Asset Bundles"にチェックを入れ
 
# "Yes, I'd like to build Asset Bundles"にチェックを入れ
 
# Bundles Base Pathにpathを入れる
 
# Bundles Base Pathにpathを入れる
 +
 +
格納先は、Application.streamingAssetsPath + "/AssetBundles/WebGL"とかになる。
 +
 +
参考:http://blog.abars.biz/archives/52407113.html
 +
 +
===自動ビルド===
 +
コミットすると自動でAsset Bundleビルドを開始するように
 +
# ConfigのBasicのAuto-Buildをonへ
  
 
===Addressable Asset ビルド===
 
===Addressable Asset ビルド===
Assets/AddressableAssetsData/WebGL/addressables_content_state.binにファイルが有るか確認。
+
ローカルのUnityのAddressableの設定方法は以下ショートカットを確認
 +
 
 +
[[Unity/Addressable]] [ショートカット]
  
 
# ConfigのAddressable Asset Optionsを選択
 
# ConfigのAddressable Asset Optionsを選択
 
# "Yes, I'd like to build Addressable Assets"にチェックを入れる
 
# "Yes, I'd like to build Addressable Assets"にチェックを入れる
 
# "Content Update Build"の項目にチェックを入れる。
 
# "Content Update Build"の項目にチェックを入れる。
# "Content State Location Method"に"use a content State file from Source Control"を選択
+
# "Content State Location Method"に"Use a content State file produced from another build target"
# Path to Content State Fileに"Assets/AddressableAssetsData/WebGL/addressables_content_state.bin"を入れる
+
# "Linked Build Target" を"Default WebGL"
 
+
 
+
  
 
2019/8ぐらいから CloudBuildにAddressablesが追加されたっぽい。
 
2019/8ぐらいから CloudBuildにAddressablesが追加されたっぽい。
行71: 行88:
 
参考:https://qiita.com/yakimeron/items/821e101307e69c8eddaf
 
参考:https://qiita.com/yakimeron/items/821e101307e69c8eddaf
  
====Addressables: Could not find a part of the path"エラーの場合====
+
====addressables_content_state.binを使ってビルド====
 +
Assets/AddressableAssetsData/WebGL/addressables_content_state.binにファイルが有るか確認。
 +
 
 +
# "Content State Location Method"に"Use a content State file from Source Control"を選択し
 +
# Path to Content State Fileに"Assets/AddressableAssetsData/WebGL/addressables_content_state.bin"を入れてるとなる。
 +
 
 
以下エラーになった場合
 
以下エラーになった場合
 
  [Unity] Error Building Addressables: Could not find a part of the path "/BUILD_PATH/new-unity-project-1.default-webgl/Assets/AddressableAssetsData/WebGL/addressables_content_state.bin".
 
  [Unity] Error Building Addressables: Could not find a part of the path "/BUILD_PATH/new-unity-project-1.default-webgl/Assets/AddressableAssetsData/WebGL/addressables_content_state.bin".
 +
 +
.gitignoreに以下のようなものが入ってないか確認。入っていれば削除して、binファイルをgitに含める。
 +
# Packed Addressables
 +
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*
 +
 +
====default-webglが無いと出るとき====
 +
以下エラーになった場合
 +
1: Error: Could not find Content State File for Linked Build Target "default-webgl". Please ensure at least one addressables build has completed successfully for that target.
 +
 +
ProfileにDefault以外が選択されてないか確認して、Default以外が選択されていれば、それを、CloudBuildのAddressableAssetOptionsのProfile Nameに入れる。
 +
 +
ProfileNameを入れても、同じエラーになった場合は、
 +
 +
default-webglに設定されている、BuildPathやLoadPathがあるか確認する。
 +
 +
====Build Remote Catalogのエラーが出るとき====
 +
以下エラーが出るとき
 +
[Unity] ERROR: Previous build had 'Build Remote Catalog' disabled.  You cannot update a player that has no remote catalog specified
 +
 +
#Assets/AddressableAssetSettingのBuildRemoteCatalogをonへ
 +
#新たに表示される、以下を項目をnullから以下へ設定する。
 +
#Build Path を RemoteBuildPath へ
 +
#Load Path を RemoteLoadPath へ
 +
#Addressableのcacheを消し、Addressableを再ビルドするとcatalogがServerData/WebGLの下にできる(例:catalog_2021.07.31.16.59.53.hashとcatalog_2021.07.31.16.59.53.json)
 +
#(オプション)AddressableAssetSettingのPlayerVersionOverrideを1.0へするとcatalog_2021.07.31.16.59.53.hash、catalog_2021.07.31.16.59.53.jsonなどが、catalog_1.0.hash、catalog__1.0.json)となる。
 +
#RemoteLoadPathのurlにServerData/WebGLの下にあるbundleとcatalogファイルをup
 +
 +
→全部実行で、ビルドできた。
 +
→RemoteLoadPathのurlに上げたデータを削除してもビルドできた。
 +
→Assets/AddressableAssetsData/WebGL/addressables_content_state.binを消すと、`[Unity] Error Building Addressables: Could not find a part of the path "/BUILD_PATH/newunityproject11.default-webgl/Assets/AddressableAssetsData/WebGL/addressables_content_state.bin".`エラーとなった。
 +
 +
参考:https://qiita.com/tetr4lab/items/1b26755089820b041b4f
 +
 +
====プレハブのAddressableがcloudbuildでは、表示されない問題====
 +
プレハブしかやってないので、他でもおこってるかもだけど・・
 +
 +
以下エラーが起こった。
 +
<pre>
 +
Exception encountered in operation InitializationOperation, status=Failed, result= : Addressables - Unable to load runtime data at location UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1[[UnityEngine.AddressableAssets.Initialization.ResourceManagerRuntimeData, Unity.Addressables, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]].
 +
Exception encountered in operation CompletedOperation, status=Failed, result= : Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=ButtonGroup, Type=UnityEngine.GameObject
 +
(Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 39)
 +
Exception encountered in operation ChainOperation<GameObject> - InitializationOperation, status=Failed, result= : ChainOperation of Type: UnityEngine.GameObject failed because dependent operation failed
 +
Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=ButtonGroup, Type=UnityEngine.GameObject
 +
</pre>
 +
 +
以下対応して、ビルドしてみるが、直らなかった。
 +
#Unityメインメニュー/Window/Addressable/Groups/PlayModeScript
 +
#"Use Existing Build(requires built groups)"に選択して、サーバーからとってこれるモードにする。
 +
#設定ファイルとして、Library/AddressablesConfig.datが変更されるようなので、gitignoreから排除して、gitに追加して実行
  
 
===BuildPlayerContentが見つからないエラーが出るとき===
 
===BuildPlayerContentが見つからないエラーが出るとき===

2021年8月2日 (月) 18:06時点における版

はじめに

よくある質問(英語):https://support.unity.com/hc/en-us/sections/201104819-Cloud-Build?_gl=1*89opoe*_ga*MTYzNjU3Mjc4NC4xNjE4ODExNzMy*_ga_1S78EFL1W5*MTYyNzg5MzkyOC4zNC4xLjE2Mjc4OTQ5NTkuMjU.&_ga=2.79763159.1135166697.1627891755-1636572784.1618811732&_gac=1.28853966.1626162759.CjwKCAjw87SHBhBiEiwAukSeURvXkmTwL_Hy5QAyIJIutPXXdinFrv-7oSTy6jvoz5n8HH0ExPg6EBoCP2sQAvD_BwE

CloudBuildはなぜ遅いのか:https://support.unity.com/hc/en-us/articles/205215503-Why-are-my-build-times-on-Cloud-Build-taking-so-long-

CloudBuildをOnへ

window/General/Services/CloudBuildをonへ

CloudBuildが使えるプランか確認

UnityTeasmAdvantedが必要なので、以下リンク先から確認

Unity/UnityTeams [ショートカット]

CloudBuild使えることを確認

  1. https://dashboard.unity3d.com/
  2. CloudBuild選択
  3. 連携してるUnityプロジェクト選択
  4. Configを開き
  5. "EDIT SOURCE CONTROL"のリンクが有効であることを確認

git連携

  1. https://dashboard.unity3d.com/
  2. CloudBuild選択
  3. 連携してるUnityプロジェクト選択
  4. Configを開き
  5. "EDIT SOURCE CONTROL"のリンクをクリック
  6. リポジトリ選択(githubとか選択してgitのプロジェクトを選択)

プラットフォーム選択

  1. Configを開き
  2. "SETUP NEW TARGET"ボタンを押して、プラットフォーム(WebGLとか)選択

Androidプラットフォームについて

  1. BundleIdを入力(com.example.~)
  2. keystoreのファイルをupload

iOSプラットフォームについて

  1. BundleIdを入力(com.example.~)
  2. プロビジョニング プロファイルをupload
  3. p12 ファイルをupload

CloudBuild実行

  1. historyからBuildボタンを押す

add a sceneエラーが出るとき

以下エラーがでるとき

There were no scenes configured to build! Please add a scene to the build using the Build Settings window of the Unity Editor.

Unityのメインメニュー/BuildSetting/SceneInBuildにAddOpenSceneを、クリックしてシーンを追加する

unavailableエラーがでるとき

loading logs; logs unavailable for this project & build.

暫く待つと治り、勝手にBuildが始まる。

WebGLプラットフォームについて

応用設定

公式: https://docs.unity3d.com/ja/2019.4/Manual/UnityCloudBuildAdvancedOptions.html

Asset Bundleビルド

  1. ConfigのAsset Bundle Optionsを選択
  2. "Yes, I'd like to build Asset Bundles"にチェックを入れ
  3. Bundles Base Pathにpathを入れる

格納先は、Application.streamingAssetsPath + "/AssetBundles/WebGL"とかになる。

参考:http://blog.abars.biz/archives/52407113.html

自動ビルド

コミットすると自動でAsset Bundleビルドを開始するように

  1. ConfigのBasicのAuto-Buildをonへ

Addressable Asset ビルド

ローカルのUnityのAddressableの設定方法は以下ショートカットを確認

Unity/Addressable [ショートカット]

  1. ConfigのAddressable Asset Optionsを選択
  2. "Yes, I'd like to build Addressable Assets"にチェックを入れる
  3. "Content Update Build"の項目にチェックを入れる。
  4. "Content State Location Method"に"Use a content State file produced from another build target"
  5. "Linked Build Target" を"Default WebGL"へ

2019/8ぐらいから CloudBuildにAddressablesが追加されたっぽい。

参考:https://qiita.com/yakimeron/items/821e101307e69c8eddaf

addressables_content_state.binを使ってビルド

Assets/AddressableAssetsData/WebGL/addressables_content_state.binにファイルが有るか確認。

  1. "Content State Location Method"に"Use a content State file from Source Control"を選択し
  2. Path to Content State Fileに"Assets/AddressableAssetsData/WebGL/addressables_content_state.bin"を入れてるとなる。

以下エラーになった場合

[Unity] Error Building Addressables: Could not find a part of the path "/BUILD_PATH/new-unity-project-1.default-webgl/Assets/AddressableAssetsData/WebGL/addressables_content_state.bin".

.gitignoreに以下のようなものが入ってないか確認。入っていれば削除して、binファイルをgitに含める。

# Packed Addressables
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*

default-webglが無いと出るとき

以下エラーになった場合

1: Error: Could not find Content State File for Linked Build Target "default-webgl". Please ensure at least one addressables build has completed successfully for that target.

ProfileにDefault以外が選択されてないか確認して、Default以外が選択されていれば、それを、CloudBuildのAddressableAssetOptionsのProfile Nameに入れる。

ProfileNameを入れても、同じエラーになった場合は、

default-webglに設定されている、BuildPathやLoadPathがあるか確認する。

Build Remote Catalogのエラーが出るとき

以下エラーが出るとき

[Unity] ERROR: Previous build had 'Build Remote Catalog' disabled.  You cannot update a player that has no remote catalog specified
  1. Assets/AddressableAssetSettingのBuildRemoteCatalogをonへ
  2. 新たに表示される、以下を項目をnullから以下へ設定する。
  3. Build Path を RemoteBuildPath へ
  4. Load Path を RemoteLoadPath へ
  5. Addressableのcacheを消し、Addressableを再ビルドするとcatalogがServerData/WebGLの下にできる(例:catalog_2021.07.31.16.59.53.hashとcatalog_2021.07.31.16.59.53.json)
  6. (オプション)AddressableAssetSettingのPlayerVersionOverrideを1.0へするとcatalog_2021.07.31.16.59.53.hash、catalog_2021.07.31.16.59.53.jsonなどが、catalog_1.0.hash、catalog__1.0.json)となる。
  7. RemoteLoadPathのurlにServerData/WebGLの下にあるbundleとcatalogファイルをup
→全部実行で、ビルドできた。
→RemoteLoadPathのurlに上げたデータを削除してもビルドできた。
→Assets/AddressableAssetsData/WebGL/addressables_content_state.binを消すと、`[Unity] Error Building Addressables: Could not find a part of the path "/BUILD_PATH/newunityproject11.default-webgl/Assets/AddressableAssetsData/WebGL/addressables_content_state.bin".`エラーとなった。

参考:https://qiita.com/tetr4lab/items/1b26755089820b041b4f

プレハブのAddressableがcloudbuildでは、表示されない問題

プレハブしかやってないので、他でもおこってるかもだけど・・

以下エラーが起こった。

Exception encountered in operation InitializationOperation, status=Failed, result= : Addressables - Unable to load runtime data at location UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1[[UnityEngine.AddressableAssets.Initialization.ResourceManagerRuntimeData, Unity.Addressables, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]. 
Exception encountered in operation CompletedOperation, status=Failed, result= : Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=ButtonGroup, Type=UnityEngine.GameObject 
(Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 39)
Exception encountered in operation ChainOperation<GameObject> - InitializationOperation, status=Failed, result= : ChainOperation of Type: UnityEngine.GameObject failed because dependent operation failed
Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=ButtonGroup, Type=UnityEngine.GameObject

以下対応して、ビルドしてみるが、直らなかった。

  1. Unityメインメニュー/Window/Addressable/Groups/PlayModeScript
  2. "Use Existing Build(requires built groups)"に選択して、サーバーからとってこれるモードにする。
  3. 設定ファイルとして、Library/AddressablesConfig.datが変更されるようなので、gitignoreから排除して、gitに追加して実行

BuildPlayerContentが見つからないエラーが出るとき

以下エラーがでるとき

Building Addressables: ERROR: Could not find BuildPlayerContent in Addressable Assets assembly.

Config/AddressablesBuildのチェックを外す

参考

https://www.fast-system.jp/unity-cloud-build-howto/