コガネブログ

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

2019-09-03から1日間の記事一覧

【C#】Dictionary を foreach で使う時の記述を簡略化する Deconstruction

ソースコード using System.Collections.Generic; public static class KeyValuePairExt { public static void Deconstruct<TKey, TValue> ( this KeyValuePair<TKey, TValue> self, out TKey key, out TValue value ) { key = self.Key; value = self.Value; } } 使用例 通常 foreach ( </tkey,></tkey,>…

【C#】Vector2 の代入を簡略化する Deconstruction

ソースコード using UnityEngine; public static class Vector2Ext { public static void Deconstruct ( this Vector2 self, out float x, out float y ) { x = self.x; y = self.y; } } 使用例 通常 var vec = new Vector2( 1, 2 ); Deconstruction var ( x…

【C#】Vector2Int の代入を簡略化する Deconstruction

ソースコード using UnityEngine; public static class Vector2IntExt { public static void Deconstruct ( this Vector2Int self, out int x, out int y ) { x = self.x; y = self.y; } } 使用例 通常 var vec = new Vector2Int( 1, 2 ); Deconstruction va…

【C#】Vector3 の代入を簡略化する Deconstruction

ソースコード using UnityEngine; public static class Vector3Ext { public static void Deconstruct ( this Vector3 self, out float x, out float y, out float z ) { x = self.x; y = self.y; z = self.z; } } 使用例 通常 var vec = new Vector3( 1, 2,…

【C#】Vector3Int の代入を簡略化する Deconstruction

ソースコード using UnityEngine; public static class Vector3IntExt { public static void Deconstruct ( this Vector3Int self, out int x, out int y, out int z ) { x = self.x; y = self.y; z = self.z; } } 使用例 通常 var vec = new Vector3Int( 1,…

【C#】Vector4 の代入を簡略化する Deconstruction

ソースコード using UnityEngine; public static class Vector4Ext { public static void Deconstruct ( this Vector4 self, out float x, out float y, out float z, out float w ) { x = self.x; y = self.y; z = self.z; w = self.w; } } 使用例 通常 var…

【C#】DateTime を代入する時の記述を簡略化する Deconstruction

ソースコード using System; public static class DateTimeExt { public static void Deconstruct ( this DateTime self, out int year, out int month, out int day ) { year = self.Year; month = self.Month; day = self.Day; } } 使用例 通常 var dt = D…

【C#】Color の代入を簡略化する Deconstruction

ソースコード using UnityEngine; public static class ColorExt { public static void Deconstruct ( this Color self, out float r, out float g, out float b ) { r = self.r; g = self.g; b = self.b; } public static void Deconstruct ( this Color se…

【C#】Color32 の代入を簡略化する Deconstruction

ソースコード using UnityEngine; public static class Color32Ext { public static void Deconstruct ( this Color32 self, out byte r, out byte g, out byte b ) { r = self.r; g = self.g; b = self.b; } public static void Deconstruct ( this Color32…

【C#】Rect の代入を簡略化する Deconstruction

ソースコード using UnityEngine; public static class RectExt { public static void Deconstruct ( this Rect self, out Vector2 position, out Vector2 size ) { position = self.position; size = self.size; } public static void Deconstruct ( this R…

【C#】null 許容型を代入する時の記述を簡略化する Deconstruction

ソースコード public static class NullableExt { public static void Deconstruct<T> ( this T? self, out bool hasValue, out T value ) where T : struct { hasValue = self.HasValue; value = self ?? default; } } 使用例 var now = DateTime.Now; var ( h</t>…

【Unity】パフォーマンス改善とデータサイズ削減についてまとめられた PDF

PDF 参考ツイート Unityについてのノウハウをまとめました。パフォーマンス改善とデータサイズ削減を中心として書いています。https://t.co/J0LGIoNDA1#Unity #UnityTips— 坂本龍 (@SakamotoRyuu) August 5, 2019

【Unity】TextMesh Pro でハイパーリンクを実装する方法

概要 上記のスクリプトを Unity プロジェクトに追加して TextMesh Pro のオブジェクトにアタッチします そして、TextMesh Pro のテキストに <link="https://www.google.co.jp/">Google</link> 上記のような link タグを使用した文字列を設定します

【Visual Studio】Ctrl + Shift + V で過去にコピーした履歴からペーストできる

概要 Ctrl + Shift + V で過去にコピーした履歴からペーストできます 参考サイト様

【Visual Studio】ビルド失敗時、成功時にサウンドを再生する方法

概要 Windows スタートメニューから「サウンドの設定」を開きます 「サウンドコントロールパネル」を開きます 「サウンド」タブを選択して、プログラムイベントの 「Microsoft Visual Studio」の項目からサウンドを再生したいタイミングを選び、 再生したい…

【Visual Studio】Ctrl キーを押している間は IntelliSense を半透明にできる

概要 Ctrl キーを押している間は IntelliSense を半透明にできます 参考サイト様

【Visual Studio 2019】ソリューション読み込み時の復元を無効化して起動時間をほんの少し改善する

概要 Visual Studio メニューの「ツール > オプション」から 「プロジェクトおよびソリューション > 全般」の ソリューションの読み込み時にドキュメントを再度開く ソリューションの読み込み時に、ソリューションエクスプローラーのプロジェクトの階層状態…

【Visual Studio】Ctrl + T でファイル、クラスを検索できる

概要 Visual Studio では Ctrl + T でファイル、クラスを検索できます 参考サイト様

【Unity】Unity IAP を正常にインポートできない場合

概要 コンパイルエラーが存在する場合は Unity IAP を正常にインポートできないので、 コンパイルエラーを修正してからインポートする必要がある