「Unity/Editor/Addressableビルド」の版間の差分
(→UnityEditorでAddressableビルド) |
|||
(同じ利用者による、間の28版が非表示) | |||
行1: | 行1: | ||
+ | ==準備== | ||
+ | 設定などは、Assets/AddressableAssetsData/AssetGroups/Default Local Groupなどに記述したAddressable含めて、(BuildPathやLoadPathなど)は、ちゃんと、読み込まれるので、事前に入れておく。 | ||
+ | |||
+ | [[Unity/Addressable]] [ショートカット] | ||
+ | |||
==UnityEditorでAddressableビルド== | ==UnityEditorでAddressableビルド== | ||
− | Assets/Editor/AddressableBuild.cs | + | Assets/Scripts/Editor/AddressableBuild.cs |
<pre> | <pre> | ||
using UnityEditor; | using UnityEditor; | ||
using UnityEngine; | using UnityEngine; | ||
using UnityEditor.AddressableAssets.Settings; | using UnityEditor.AddressableAssets.Settings; | ||
+ | using UnityEditor.Build.Pipeline.Utilities; | ||
public static class AddressableBuild | public static class AddressableBuild | ||
{ | { | ||
行12: | 行18: | ||
AddressableAssetSettings.BuildPlayerContent(); | AddressableAssetSettings.BuildPlayerContent(); | ||
} | } | ||
− | [MenuItem("Tools/ | + | // Addressable/CleanBuild/All (Library/com.unity.addressablesと、Library/BuildCacheが、削除される) |
− | private static void | + | [MenuItem("Tools/AddressableCleanAll")] |
+ | private static void CleanAll() | ||
{ | { | ||
AddressableAssetSettings.CleanPlayerContent(); | AddressableAssetSettings.CleanPlayerContent(); | ||
+ | BuildCache.PurgeCache(false); | ||
} | } | ||
} | } | ||
行22: | 行30: | ||
==profileを指定== | ==profileを指定== | ||
− | Assets/Editor/AddressableBuild.cs | + | Assets/Scripts/Editor/AddressableBuild.cs |
<pre> | <pre> | ||
using UnityEditor; | using UnityEditor; | ||
行29: | 行37: | ||
using UnityEditor.AddressableAssets; | using UnityEditor.AddressableAssets; | ||
using UnityEditor.AddressableAssets.Settings; | using UnityEditor.AddressableAssets.Settings; | ||
+ | using UnityEditor.Build.Pipeline.Utilities; | ||
public static class AddressableBuild | public static class AddressableBuild | ||
{ | { | ||
行35: | 行44: | ||
{ | { | ||
string profileID = "Default"; | string profileID = "Default"; | ||
+ | // string profileID = "WebGL"; | ||
var settings = AddressableAssetSettingsDefaultObject.Settings; | var settings = AddressableAssetSettingsDefaultObject.Settings; | ||
settings.activeProfileId = settings.profileSettings.GetProfileId(profileID); | settings.activeProfileId = settings.profileSettings.GetProfileId(profileID); | ||
AddressableAssetSettings.CleanPlayerContent(); | AddressableAssetSettings.CleanPlayerContent(); | ||
+ | BuildCache.PurgeCache(false); | ||
AddressableAssetSettings.BuildPlayerContent(); | AddressableAssetSettings.BuildPlayerContent(); | ||
} | } | ||
} | } | ||
</pre> | </pre> | ||
+ | |||
+ | 参考:https://qiita.com/IShix/items/d2acd9ad216a69a4db57 | ||
+ | |||
+ | ==CleanBuildのAllを実行== | ||
+ | Addressable/CleanBuild/All に当たる部分 | ||
+ | |||
+ | Assets/Scripts/Editor/AddressableBuild.cs | ||
+ | <pre> | ||
+ | using UnityEditor; | ||
+ | using UnityEditor.AddressableAssets; | ||
+ | using UnityEditor.AddressableAssets.Settings; | ||
+ | using UnityEditor.Build.Pipeline.Utilities; | ||
+ | public static class AddressableBuild | ||
+ | { | ||
+ | // Addressable/CleanBuild/All (Library/com.unity.addressablesと、Library/BuildCacheが、削除される) | ||
+ | [MenuItem("Tools/AddressableCleanAll")] | ||
+ | private static void CleanAll() | ||
+ | { | ||
+ | AddressableAssetSettings.CleanPlayerContent(); | ||
+ | BuildCache.PurgeCache(false); | ||
+ | } | ||
+ | } | ||
+ | </pre> | ||
+ | ==CleanBuildのContentsBuilders/Allを実行== | ||
+ | Addressable/CleanBuild/ContentsBuilders/All に当たる部分 | ||
+ | |||
+ | Assets/Scripts/Editor/AddressableBuild.cs | ||
+ | <pre> | ||
+ | using UnityEditor; | ||
+ | using UnityEditor.AddressableAssets; | ||
+ | using UnityEditor.AddressableAssets.Settings; | ||
+ | using UnityEditor.Build.Pipeline.Utilities; | ||
+ | public static class AddressableBuild | ||
+ | { | ||
+ | // Addressable/CleanBuild/ContentsBuilders/All (Library/com.unity.addressablesが削除される) | ||
+ | [MenuItem("Tools/AddressableCleanContentsBuilders")] | ||
+ | private static void CleanContentsBuilders() | ||
+ | { | ||
+ | AddressableAssetSettings.CleanPlayerContent(); | ||
+ | } | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | ==CleanBuildのBuild Pipeline Cacheを実行== | ||
+ | Addressable/CleanBuild/"Build Pipeline Cache" に当たる部分 | ||
+ | |||
+ | Assets/Scripts/Editor/AddressableBuild.cs | ||
+ | <pre> | ||
+ | using UnityEditor; | ||
+ | using UnityEngine; | ||
+ | using UnityEditor.AddressableAssets.Settings; | ||
+ | using UnityEditor.Build.Pipeline.Utilities; | ||
+ | public static class AddressableBuild | ||
+ | { | ||
+ | // Addressable/CleanBuild/Build Pipeline Cache (Library/BuildCacheが削除される) | ||
+ | [MenuItem("Tools/AddressableCleanPipelineCache")] | ||
+ | private static void CleanPipelineCache() | ||
+ | { | ||
+ | BuildCache.PurgeCache(false); | ||
+ | } | ||
+ | } | ||
+ | </pre> | ||
+ | 参考:https://baba-s.hatenablog.com/entry/2020/03/19/040000 | ||
+ | |||
+ | ==出力ファイル== | ||
+ | BuildPathの設定次第で、出力される場所が違う。 | ||
+ | |||
+ | *LocalBuildPath:Library/com.unity.addressables/aa/WebGL/WebGL | ||
+ | *RemoteBuildPath:ServerData/WebGL | ||
+ | |||
+ | ファイルは defaultlocalgroup_assets_all_69745f2bc65176429eb31f083306322b.bundle な感じのファイルが出来る。 |
2022年3月2日 (水) 21:18時点における最新版
目次
準備
設定などは、Assets/AddressableAssetsData/AssetGroups/Default Local Groupなどに記述したAddressable含めて、(BuildPathやLoadPathなど)は、ちゃんと、読み込まれるので、事前に入れておく。
Unity/Addressable [ショートカット]
UnityEditorでAddressableビルド
Assets/Scripts/Editor/AddressableBuild.cs
using UnityEditor; using UnityEngine; using UnityEditor.AddressableAssets.Settings; using UnityEditor.Build.Pipeline.Utilities; public static class AddressableBuild { [MenuItem("Tools/AddressableBuild")] private static void Build() { AddressableAssetSettings.BuildPlayerContent(); } // Addressable/CleanBuild/All (Library/com.unity.addressablesと、Library/BuildCacheが、削除される) [MenuItem("Tools/AddressableCleanAll")] private static void CleanAll() { AddressableAssetSettings.CleanPlayerContent(); BuildCache.PurgeCache(false); } }
参考:https://baba-s.hatenablog.com/entry/2020/03/16/080000
profileを指定
Assets/Scripts/Editor/AddressableBuild.cs
using UnityEditor; using UnityEngine; using NUnit.Framework; using UnityEditor.AddressableAssets; using UnityEditor.AddressableAssets.Settings; using UnityEditor.Build.Pipeline.Utilities; public static class AddressableBuild { [MenuItem("Tools/AddressableCleanBuild")] private static void CleanBuild() { string profileID = "Default"; // string profileID = "WebGL"; var settings = AddressableAssetSettingsDefaultObject.Settings; settings.activeProfileId = settings.profileSettings.GetProfileId(profileID); AddressableAssetSettings.CleanPlayerContent(); BuildCache.PurgeCache(false); AddressableAssetSettings.BuildPlayerContent(); } }
参考:https://qiita.com/IShix/items/d2acd9ad216a69a4db57
CleanBuildのAllを実行
Addressable/CleanBuild/All に当たる部分
Assets/Scripts/Editor/AddressableBuild.cs
using UnityEditor; using UnityEditor.AddressableAssets; using UnityEditor.AddressableAssets.Settings; using UnityEditor.Build.Pipeline.Utilities; public static class AddressableBuild { // Addressable/CleanBuild/All (Library/com.unity.addressablesと、Library/BuildCacheが、削除される) [MenuItem("Tools/AddressableCleanAll")] private static void CleanAll() { AddressableAssetSettings.CleanPlayerContent(); BuildCache.PurgeCache(false); } }
CleanBuildのContentsBuilders/Allを実行
Addressable/CleanBuild/ContentsBuilders/All に当たる部分
Assets/Scripts/Editor/AddressableBuild.cs
using UnityEditor; using UnityEditor.AddressableAssets; using UnityEditor.AddressableAssets.Settings; using UnityEditor.Build.Pipeline.Utilities; public static class AddressableBuild { // Addressable/CleanBuild/ContentsBuilders/All (Library/com.unity.addressablesが削除される) [MenuItem("Tools/AddressableCleanContentsBuilders")] private static void CleanContentsBuilders() { AddressableAssetSettings.CleanPlayerContent(); } }
CleanBuildのBuild Pipeline Cacheを実行
Addressable/CleanBuild/"Build Pipeline Cache" に当たる部分
Assets/Scripts/Editor/AddressableBuild.cs
using UnityEditor; using UnityEngine; using UnityEditor.AddressableAssets.Settings; using UnityEditor.Build.Pipeline.Utilities; public static class AddressableBuild { // Addressable/CleanBuild/Build Pipeline Cache (Library/BuildCacheが削除される) [MenuItem("Tools/AddressableCleanPipelineCache")] private static void CleanPipelineCache() { BuildCache.PurgeCache(false); } }
参考:https://baba-s.hatenablog.com/entry/2020/03/19/040000
出力ファイル
BuildPathの設定次第で、出力される場所が違う。
- LocalBuildPath:Library/com.unity.addressables/aa/WebGL/WebGL
- RemoteBuildPath:ServerData/WebGL
ファイルは defaultlocalgroup_assets_all_69745f2bc65176429eb31f083306322b.bundle な感じのファイルが出来る。