コガネブログ

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

2025-02-01から1ヶ月間の記事一覧

【Unity】M4 Pro Mac mini の速度検証

はじめに M4 Pro Mac mini を購入したので、M1 Max MacBook Pro と速度を比較した。 目次 はじめに 目次 検証環境 マシンスペック 計測結果 計測方法 Geekbench 6 リコンパイル時間 Android ビルド時間 iOS ビルド時間 アセットバンドルビルド時間 雑感 検証…

【Unity】iOS / Android の発熱やバッテリーの情報を取得できる「Unity Mobile Support - Thermal」紹介

概要 上記のパッケージを Unity プロジェクトに追加することで iOS / Android の発熱やバッテリーの情報を取得できるようになります。 使用例 Android using MobileSupport; using TMPro; using UnityEngine; internal sealed class Example : MonoBehaviour…

【Python】「ModuleNotFoundError: No module named 'aifc'」

概要 % python -c "import aifc; print('aifc module is available')" Traceback (most recent call last): File "<string>", line 1, in <module> import aifc; print('aifc module is available') ^^^^^^^^^^^ ModuleNotFoundError: No module named 'aifc' Python 3.13 で</module></string>…

【Mac】「zsh: command not found: pip」

概要 zsh: command not found: pip 新しく購入した Mac に Python 3.13 をインストールして pip install を実行したら上記のエラーが発生する現象に遭遇した。 curl -sS https://bootstrap.pypa.io/get-pip.py | /Library/Frameworks/Python.framework/Versi…

【Unity】使用している Xcode のバージョンを取得する関数

概要 using System; using System.Diagnostics; using System.Linq; namespace Kogane { /// <summary> /// Xcode のバージョンを取得する時に使用するクラス /// </summary> public static class GetXcodeVersion { //=======================================================…

【Unity】「unsupported option '-G' for target 'arm64-apple-ios10.0'」

概要 unsupported option '-G' for target 'arm64-apple-ios10.0' Firebase を使用している Unity プロジェクトを Unity 2022.3.22f1 で iOS ビルドして、生成された Xcode プロジェクトを Xcode 16.2 でビルドしたら上記のエラーが発生する現象に遭遇した。…

【Mac】Karabiner-Elements で使用している設定

概要 f16 を使用している理由 Mac のシステム設定の「キーボード > キーボードショートカット...」の 「入力ソース > 前の入力ソースを選択」に F16 を設定することで 日本語配列キーボードの半角/全角キーを使えるようにしている。 参考サイト様

【Unity】「Failed to determine iphoneos sdk installation path - /Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk does not exist, and "xcrun --sdk iphoneos --show-sdk-path" failed with xcrun: error: SDK "iph

概要 Library/Bee/artifacts/iOS/AsyncPluginsFromLinker: Burst internal compiler error: Burst.Compiler.IL.Aot.AotLinkerException: Failed to determine iphoneos sdk installation path - /Applications/XCode.app/Contents/Developer/Platforms/iPhon…

【Unity】「Could not find a working python interpreter.」

概要 Could not find a working python interpreter. Please make sure one of the following is in your PATH: python3 python3.8 python3.7 python2.7 python2 python UnityEngine.Debug:LogError (object) Firebase.Editor.PythonExecutor:FindPythonInte…

【Rider】「MSBuild が見つかりません」

概要 Unity プロジェクトのソリューションを Rider で開いた時に 上記のエラーが発生する現象に遭遇した Rider の 設定 | 環境 の「.NET」の「Install」を実行して Rider を終了して Unity の「Preferences > External Tools」の 「Regenerate project files…

【Rider】[EditorBrowsable( EditorBrowsableState.Never )] が効かない場合

概要 ファイル | 設定 | エディター | 一般 | コード補完 の メンバーを [EditorBrowsable] 属性別にフィルター をオンにする 参考サイト様 https://youtrack.jetbrains.com/issue/RIDER-17669

【Unity】Editor.OnInspectorGUI の ReorderableList の変更は EditorGUI.ChangeCheckScope で検知できない

概要 public override void OnGUI( string searchContext ) { using var changeCheckScope = new EditorGUI.ChangeCheckScope(); m_editor.OnInspectorGUI(); if ( !changeCheckScope.changed ) return; // ReorderableList を変更してもここに来ない } 対策…

【Unity】Inspector のコンポーネントの表示をデフォルトで折りたたんでおくエディタ拡張の例

ソースコード using System; using System.Linq; using UnityEditor; using UnityEditorInternal; using UnityEngine; [InitializeOnLoad] internal static class Example { private static readonly Type PROPERTY_EDITOR_TYPE = typeof( Editor ).Assembly…

【C#】配列やリストの要素を交互に連結する拡張メソッド

ソースコード public static IEnumerable<T> MergeInterleaved<T> ( this IEnumerable<T> self, IEnumerable<T> second ) { return self .Zip( second, ( x, y ) => new[] { x, y } ) .SelectMany( x => x ) ; } 参考サイト様</t></t></t></t>

【Unity】Auto Size を使用している TextMesh Pro の FontSize をスクリプトから取得する場合

概要 ForceMeshUpdate を使用すると正しい FontSize が取得できる

【雑記】yt-dlp で特定の YouTube チャンネルの動画を一括でダウンロードするバッチファイル

概要 yt-dlp.exe -o "%%(upload_date>%%Y%%m%%d)s_%%(title)s.%%(ext)s" -f best "https://www.youtube.com/@Hoge" pause 参考サイト様

【Unity】Time.timeScale を特定の範囲でのみ変更するクラス

ソースコード using System; using UnityEngine; namespace Kogane { public sealed class SetTimeScaleScope : IDisposable { private readonly float m_oldTimeScale; private bool m_isDisposed; public SetTimeScaleScope( float timeScale ) { m_oldTim…

【Unity】Time.fixedDeltaTime を特定の範囲でのみ変更するクラス

ソースコード using System; using UnityEngine; namespace Kogane { public sealed class SetTimeFixedDeltaTimeScope : IDisposable { private readonly float m_oldFixedDeltaTime; private bool m_isDisposed; public SetTimeFixedDeltaTimeScope( float…

【Unity】Physics2D.IgnoreCollision を拡張メソッドで呼び出せるようにする

ソースコード using UnityEngine; namespace Kogane { public static class Collider2DExtensionMethods { /// <summary> /// Physics2D.IgnoreCollision を呼び出します /// </summary> public static void IgnoreCollision ( this Collider2D self, Collider2D collider2 ) { …

【Unity】Physics2D.simulationMode を特定の範囲でのみ変更するクラス

ソースコード using System; using UnityEngine; namespace Kogane { public sealed class SetPhysics2DSimulationModeScope : IDisposable { private readonly SimulationMode2D m_oldSimulationMode; private bool m_isDisposed; public SetPhysics2DSimul…

【Unity】スクリプトから Game ビューの Scale を変更する方法

概要 using System; using System.Reflection; using UnityEditor; using UnityEngine; internal static class Example { [MenuItem( "hoge/hoge" )] private static void Hoge() { const BindingFlags bindingAttrs = BindingFlags.Instance | BindingFlags…

【Unity】スクリプトから Game ビューを最大化する方法

概要 using System; using UnityEditor; internal static class Example { [MenuItem( "hoge/hoge" )] private static void Hoge() { var type = Type.GetType( "UnityEditor.GameView,UnityEditor" ); var editorWindow = EditorWindow.GetWindow( type ); …

【Unity】PlayModeWindow.SetCustomRenderingResolution で Game ビューの解像度を指定する方法

概要 using UnityEditor; internal static class Example { [MenuItem( "hoge/hoge" )] private static void Hoge() { PlayModeWindow.SetCustomRenderingResolution ( width: 480, height: 270, baseName: "480x270" ); } }