コガネブログ

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

2025-03-06から1日間の記事一覧

【Unity】Game ビューのツールバーを非表示にする例

概要 using System; using System.Reflection; using UnityEditor; internal static class Example { [MenuItem( "Tools/Run" )] private static void Run() { const BindingFlags bindingAttrs = BindingFlags.Instance | BindingFlags.NonPublic; var game…

【Unity】2022.3.45f1 で JetBrains.Annotations.MustDisposeResource が使えるようになった

概要 破棄していないインスタンスがわかるようになる。 参考サイト様

【Unity】Game ビューの解像度を特定の範囲でのみ変更する構造体

ソースコード #if UNITY_EDITOR using System; using UnityEditor; namespace Kogane { public struct SetPlayModeWindowCustomRenderingResolutionScope : IDisposable { private readonly uint m_width; private readonly uint m_height; private bool m_i…

【Unity】Game ビューの解像度のインデックスを特定の範囲でのみ変更する構造体

ソースコード #if UNITY_EDITOR using System; using System.Reflection; using UnityEditor; namespace Kogane { public struct SetGameViewSelectedSizeIndexScope : IDisposable { private const BindingFlags BINDING_ATTRS = BindingFlags.Instance | B…

【Unity】Game ビューの解像度のインデックスを取得する例

概要 const BindingFlags bindingAttrs = BindingFlags.Instance | BindingFlags.Public; var gameViewType = Type.GetType( "UnityEditor.GameView,UnityEditor" ); var selectedSizeIndexInfo = gameViewType!.GetProperty( "selectedSizeIndex", bindingA…

【Unity】Game ビューの Scale を特定の範囲でのみ変更する構造体

ソースコード #if UNITY_EDITOR using System; using System.Reflection; using UnityEditor; using UnityEngine; namespace Kogane { public struct SetGameViewZoomAreaScaleScope : IDisposable { private const BindingFlags BINDING_ATTRS = BindingFla…

【Unity】Game ビューの maximized を特定の範囲でのみ変更する構造体

ソースコード #if UNITY_EDITOR using System; using UnityEditor; namespace Kogane { public struct SetGameViewMaximizedScope : IDisposable { private static readonly Type GAME_VIEW_TYPE = Type.GetType( "UnityEditor.GameView,UnityEditor" ); pri…