2022-09-10から1日間の記事一覧
ソースコード using System; namespace Kogane { public static class TypeUtils { public static string GetCSharpTypeKeyword( Type type ) { return GetCSharpTypeKeyword( type.Name ); } // https://stackoverflow.com/questions/56352299/gettype-retu…
ソースコード using System; using System.Linq; namespace Kogane { public static class TypeUtils { // https://stackoverflow.com/questions/1533115/get-generictype-name-in-good-format-using-reflection-on-c-sharp public static string GetPrettyN…
概要 Rider の Preferences の「Editor > Live Templates > C#」を選択して 「New Template」のアイコンを押して 「Shortcut:」に summaryComment と入力して左のテキストエリアに /// <summary> /// $END$ /// </summary> と入力して保存する 設定
ソースコード using System; using System.Reflection; using UnityEditor; namespace Kogane.Internal { public static class PropertyEditorInternal { private const BindingFlags BINDING_ATTRS = BindingFlags.Instance | BindingFlags.NonPublic; priv…
概要 Before After 重ねた場合 備考 上記のシェーダは以下の公式フォーラムで投稿されていたものになります
ソースコード #if UNITY_EDITOR using System; using System.Collections.Generic; using JetBrains.Annotations; // ReSharper disable IdentifierTypo // ReSharper disable InconsistentNaming namespace Kogane { [PublicAPI] [Obsolete( "", true )] pu…
スライド
概要 備考 上記のシェーダは以下の公式フォーラムで投稿されていたものになります
ソースコード using UnityEngine; namespace Kogane { public static class DebugLogMethodChainingExtensionMethods { public delegate void LogDelegate( object item ); public static LogDelegate OnLog { get; set; } = item => Debug.Log( item ); pub…
ソースコード #if UNITY_EDITOR using System; using JetBrains.Annotations; // ReSharper disable IdentifierTypo // ReSharper disable InconsistentNaming namespace Kogane { [PublicAPI] [Obsolete( "", true )] public static class SourceTemplateCo…
ソースコード namespace Kogane { public static class StringExtensionMethods { public static bool IsAlphanumeric( this string self ) { for ( var i = 0; i < self.Length; i++ ) { var x = self[ i ]; if ( !char.IsLetterOrDigit( x ) ) { return fa…
ソースコード namespace Kogane { public static class CharExtensionMethods { public static bool IsAlphanumeric( this char self ) { return char.IsLetterOrDigit( self ); } } } 使用例 Debug.Log( '0'.IsAlphanumeric() ); // True Debug.Log( 'A'.Is…
概要 var isAlphanumeric = char.IsLetterOrDigit( 'A' ); // True char.IsLetterOrDigit を使うと判定できる 0 ~ 9、A ~ Z、a ~ z は True になる 記号や半角スペースは False になる 使用例 // 0 ~ 9、A ~ Z、a ~ z は True になる var isAlphanumeric = "…
概要 「GameObject」メニューにゲームオブジェクトを作成するメニューを追加する場合、 「GameObjectUtility.SetParentAndAlign」を必ず呼び出し、 親を設定し、子に同じレイヤーと位置を与えます。 また、「Undo.RegisterCreatedObjectUndo」を呼び出して作…
ソースコード using System; using System.Collections.Generic; using JetBrains.Annotations; namespace Kogane { public static class IEnumerablePeekExtensionMethods { public static IEnumerable<T> Peek<T> ( [NotNull] this IEnumerable<T> source, [NotNull</t></t></t>…
概要 xcopy /e /s /y ^ "【Unity プロジェクト A のパス】\Packages\*" ^ "【Unity プロジェクト B のパス】\Packages"
ソースコード using System; using System.Collections.Generic; using JetBrains.Annotations; using UnityEngine; namespace Kogane { public static class IEnumerableLogExtensionMethods { public delegate void LogDelegate( object item ); public st…