コガネブログ

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

2020-10-06から1日間の記事一覧

【Unity】エディタ拡張でショートカットキーから関数を呼び出せるようにする「ClutchShortcutAttribute」

概要 using UnityEditor.ShortcutManagement; using UnityEngine; public static class Example { // F1 で呼び出されるようにする [ClutchShortcut( "Kogane/Hoge1", KeyCode.F1 )] private static void Hoge1() { Debug.Log( "ピカチュウ" ); } // Alt + F…

【Unity】RectTransform の「Some values driven by XXXX」の状態を取得する方法

概要 using System.Reflection; using UnityEditor; using UnityEngine; public static class Example { [MenuItem( "Tools/Hoge" )] private static void Hoge() { var rectTransform = ( RectTransform ) Selection.activeTransform; var type = typeof( R…

【Unity】エディタ拡張で Preloaded Assets に Missing が存在しないかどうか確認する方法

概要 using System.Linq; using UnityEditor; using UnityEngine; public class Example { [MenuItem( "Tools/Hoge" )] private static void Hoge() { var hasMissing = PlayerSettings .GetPreloadedAssets() .Any( x => x == null ) ; Debug.Log( hasMissi…

【Unity】StreamingAssets と Android の App Bundle に関する不具合メモ

概要 問題を回避するためには StreamingAssets 内のファイルの名前を すべて小文字にする必要があるらしい Unity 2020.1 以降は Gradle 3.6 が使用されており、この問題が発生しない?

【Unity】Progress が実行中なら Unity を再生できなくするエディタ拡張

概要 using UnityEditor; using UnityEngine; [InitializeOnLoad] public static class Example { static Example() { EditorApplication.playModeStateChanged += OnChanged; } private static void OnChanged( PlayModeStateChange change ) { if ( !Progr…