コガネブログ

平日更新を目標に Unity や C#、Visual Studio、ReSharper などのゲーム開発アレコレを書いていきます

2020-03-16から1日間の記事一覧

【Unity】Addressable Asset System の設定が変更された時に呼び出されるイベント

概要 using UnityEditor; using UnityEditor.AddressableAssets.Settings; using UnityEngine; [InitializeOnLoad] public static class Example { static Example() { AddressableAssetSettings.OnModificationGlobal += OnModificationGlobal; } private s…

【Unity】Addressable Asset System の AddressableAssetEntry.SetAddress はアドレスが変更された時のみ処理が実行されるようになっている

概要 public void SetAddress(string addr, bool postEvent = true) { if (m_Address != addr) { m_Address = addr; if (string.IsNullOrEmpty(m_Address)) m_Address = AssetPath; SetDirty(AddressableAssetSettings.ModificationEvent.EntryModified, thi…

【Unity】Addressable Asset System の Play Mode Script を変更するエディタ拡張

概要 使用例 using UnityEditor; public static class Example { [MenuItem( "Tools/Hoge" )] private static void Hoge() { // デフォルトなら // 0: Use Asset Database (faster) // 1: Simulate Groups (advanced) // 2: Use Existing Build (requires bu…

【Unity】Addressable Asset System でデフォルト以外のすべてのグループを削除するエディタ拡張

概要 使用例 using UnityEditor; public static class Example { [MenuItem( "Tools/Hoge" )] private static void Hoge() { AddressableUtils.RemoveAllGroupWithoutDefault(); } }

【Unity】Addressable Asset System でアセットやフォルダにラベルを割り当てる・解除するエディタ拡張

概要 使用例 using UnityEditor; public static class Example { [MenuItem( "Tools/Hoge" )] private static void Hoge() { // アセットにラベルを割り当てます AddressableUtils.SetLabelToAssetOrFolder ( path:"Assets/New Material.mat", label: "hoge"…

【Unity】Addressable Asset System でアセットやフォルダにアドレスを割り当ててグループに追加するエディタ拡張

概要 使用例 using UnityEditor; public static class Example { [MenuItem( "Tools/Hoge" )] private static void Hoge() { // アセットにアドレスを割り当ててグループに追加する AddressableUtils.SetAddressToAssetOrFolder ( path:"Assets/New Material…

【Unity】Addressable Asset System のグループを作成するエディタ拡張

概要 使用例 using UnityEditor; public static class Example { [MenuItem( "Tools/Hoge" )] private static void Hoge() { var group = AddressableUtils.GetOrCreateGroup( "test" ); } }

【Unity】エディタ拡張で Addressable Asset System のビルド・クリーンを実行する方法

概要 using UnityEditor; using UnityEditor.AddressableAssets.Settings; public static class Test { [MenuItem( "Tools/Build" )] private static void Build() { AddressableAssetSettings.BuildPlayerContent(); } [MenuItem( "Tools/Clean" )] private…

【Unity】すべてのアセットバンドル名を削除するエディタ拡張メモ

概要 using UnityEditor; public static class Example { [MenuItem( "Tools/アセットバンドル名全削除" )] private static void Hoge() { AssetDatabase.StartAssetEditing(); foreach ( var assetPath in AssetDatabase.GetAllAssetPaths() ) { var assetI…