コガネブログ

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

【Unity】メモリが許す限り Profile を記録できる簡易プロファイラ「UnityProfilerLiteKun」紹介

はじめに 「UnityProfilerLiteKun」は メモリが許す限り Profile を記録できる簡易プロファイラです 使用例 クイックスタート Unity メニューの「Window > UTJ > UnityProfilerLiteKun」を押して 通常の Profile と同様にビルドしたプレイヤーに接続して レ…

【Unity】Overdraw を計測して解析できる「UnityOverDrawKun」紹介

はじめに 「UnityOverDrawKun」を Unity プロジェクトに導入することで Overdraw を計測して解析できるようになります 使用例 クイックスタート 「OverdrawCamera」プレハブをシーンに配置して 「Target Display」を「Display 1」以外に変更し、 「Master Ca…

【Unity】Risk of unwanted modifications

概要 Risk of unwanted modifications The following scripts on the Prefab open ion Prefab Mode use the [ExecuteInEditMode] attribute which means they may accidentally affect or be affected by Play Mode: XXXX See the documentation for [Execut…

【Unity】Corgi Engine で動く床に合わせてプレイヤーが移動しない場合

概要 Corgi Engine で動く床に合わせてプレイヤーが移動しない場合、 動く床に「Moving Platform Free」をアタッチすると 動く床に合わせてプレイヤーが移動するようになります

【Rider】ツールバーに好きなコマンドを追加する方法

概要 Rider のツールバーの空いている箇所を右クリックして 「メニューおよびツールバーをカスタマイズ...」を選択して 「メインツールバー」の中の項目を選択した状態で 「+ > アクションを追加...」を選択して 追加したいコマンドを選択して「OK」を押して…

【Fork】コミットメッセージを変更する方法

概要 コミットログを右クリックして「Interactive Rebase > Reword...」を押して 新しいコミットメッセージを入力して「OK」を押して 「Rebase」を押すとコミットメッセージを変更できます

【Unity】スクリプトからキャッシュサーバ(Accelerator)にアクセスしているか確認する方法

概要 using UnityEditor; [InitializeOnLoad] public static class Example { static Example() { EditorApplication.update += () => { Debug.Log( AssetDatabase.IsConnectedToCacheServer() ); }; } } AssetDatabase.IsConnectedToCacheServer() を使用す…

【Unity】Corgi Engine でプレイヤーがやられたかどうか検知する方法

概要 using System; using MoreMountains.CorgiEngine; using MoreMountains.Tools; using UnityEngine; public sealed class PlayerDeathListener : MonoBehaviour, MMEventListener<CorgiEngineEvent> { public event Action OnDead; private void OnEnable() { this.MMEvent</corgiengineevent>…

【C#】Flags が付いている列挙型で ALL を表現する方法

C#

概要 [Flags] public enum PokemonType { FIRE = 1 << 0, WATER = 1 << 1, GRASS = 1 << 2, ALL = FIRE | WATER | GRASS, } 上記のように Flags が付いている列挙型で ALL を表現している場合、 [Flags] public enum PokemonType { FIRE = 1 << 0, WATER = 1 …

【Visual Studio】構造体の表示色を変える方法

概要 Visual Studio メニューの「ツール > オプション」を選択して 左メニューの「環境 > フォントおよび色」を選択して 「ユーザータイプ - 構造体」を選択して「前景色」を変更して「OK」を押すと 構造体の表示色を変更できます

【Unity】Kinematic 2D で急な坂道(Slope)の上でジャンプできないようにする方法

概要 「Vertical Movement」の「Jump Only On Stable Ground」をオンにすると 急な坂道(Slope)の上でジャンプできないようになる

【Unity】Corgi Engine でブロックに潰されたらプレイヤーがやられるようにする方法

概要 Corgi Engine でブロックに潰されたらプレイヤーがやられるようにしたい場合は 「Character Crush Detection」と「Health」を使用する if (DieWhenCrushed) { // we kill the character _health.Kill (); CorgiEngineEvent.Trigger(CorgiEngineEventTyp…

【Unity】Corgi Engine で乗っている坂道(Slope)の角度を取得する方法

概要 CorgiController.State.BelowSlopeAngle を参照する using MoreMountains.CorgiEngine; using UnityEngine; [RequireComponent( typeof( CorgiController ) )] public sealed class Player : MonoBehaviour { [SerializeField] private CorgiController…

【Unity】Corgi Engine で坂道(Slope)の上でジャンプできないようにする方法

概要 Corgi Engine で「Corgi Controller」の 「Maximum Slope Angle」に設定している角度よりも急角度な坂道に乗っている時に ジャンプできないようにしたい場合は以下のようなスクリプトを作成します using MoreMountains.CorgiEngine; using UnityEngine;…

【Unity】Corgi Engine で坂道(Slope)を滑らない場合

概要 Corgi Engine で「Corgi Controller」の 「Maximum Slope Angle」に設定している角度よりも急角度な坂道に乗った時に 坂道を滑らずに自由に移動できてしまう場合は 「Corgi Conteoller」の「Ray Offset」の数値を増やして「Stick To Slopes」をオフにす…