2020-03-01から1ヶ月間の記事一覧
ソースコード 使用例 using System.Collections; using Unity.EditorCoroutines.Editor; using UnityEditor; using UnityEngine; public static class Example { [MenuItem( "Tools/Hoge" )] private static void Hoge() { EditorCoroutineUtility.StartCoro…
ソースコード using UnityEditor; using UnityEngine; [InitializeOnLoad] public static class Example { static Example() { if ( EditorUserBuildSettings.activeBuildTarget == BuildTarget.Android ) return; Debug.LogError( "Android に Switch Platf…
概要
ソースコード 使い方 ゲームオブジェクトに上記のスクリプトをアタッチすると 毎フレーム画面をランダムにクリックします DontDestroyOnLoad が適用されたゲームオブジェクトにアタッチすると そのゲームオブジェクトが破棄されるまで画面をランダムにクリッ…
概要 C:\Users\【ユーザー名】\.RiderXXXX.X\config\resharper-host 参考サイト様
概要 C:\Users\【ユーザー名】\AppData\Roaming\JetBrains\Shared\vAny 参考サイト様
概要 Unity で Color 構造体を記述する時にコード補完に System.Drawing.Color が表示されることが煩わしい場合は Visual Studio メニューの「RESHARPER > Options...」から 「Code Inspection > Settings > Auto Import」を選択し、リストに 「System.Drawi…
概要 Unity で Debug クラスを記述する時にコード補完に System.Diagnostics.Debug が表示されることが煩わしい場合は Visual Studio メニューの「RESHARPER > Options...」から 「Code Inspection > Settings > Auto Import」を選択し、リストに 「System.D…
概要 Unity で Image クラスを記述する時にコード補完に System.Net.Mime.MediaTypeNames.Image UnityEngine.UIElements.Image が表示されることが煩わしい場合は Visual Studio メニューの「RESHARPER > Options...」から 「Code Inspection > Settings > A…
概要 例えば、このように描画されるシーンで OnDemandRendering.renderFrameInterval = 30; 上記のコードを記述すると 30 フレームごとにゲーム画面の描画が更新されるようになります これまでも Application.targetFrameRate を使用すれば同じようなことが…
概要 Image の Use Sprite Mesh をオンにした状態で 赤枠のアイコンを押して Select Preset ウィンドウで「Save current to...」ボタンを押して ダイアログが表示されたらプリセットを保存するフォルダと ファイル名を設定して「保存」を押して Project ビュ…
概要 Canvas Scaler の UI Scale Mode や Reference Resolution を設定した状態で 赤枠のアイコンを押して Select Preset ウィンドウで「Save current to...」ボタンを押して ダイアログが表示されたらプリセットを保存するフォルダと ファイル名を設定して…
概要 Canvas Renderer の赤枠のアイコンを押して Select Preset ウィンドウで「Save current to...」ボタンを押して ダイアログが表示されたらプリセットを保存するフォルダと ファイル名を設定して「保存」を押して Project ビューで作成されたプリセットを…
概要 例えば uGUI の Image の Raycast Target をデフォルトでオフにしたい場合は Image コンポーネントの赤枠のアイコンを押して Select Preset ウィンドウで「Save current to...」ボタンを押して New Preset ダイアログで保存するフォルダとファイル名を…
概要 using UnityEngine; public class Example : MonoBehaviour { private void Update() { Log( "ピカチュウ" ); } #if DISABLE_DEBUG_LOG [System.Diagnostics.Conditional( "DUMMY" )] #endif private void Log( string message ) { Debug.Log( message …
スクリプト 使用例 using UnityEngine; public class Example : MonoBehaviour { private readonly CustomLogger m_logger = CustomLogger.Create( "タイトル" ); private void Awake() { m_logger.Log( "Log" ); m_logger.Log( "Log", gameObject ); m_logg…
ソースコード 使用例 通常 using UnityEngine; using UnityEngine.Profiling; public class Example : MonoBehaviour { private void Update() { var sampler = CustomSampler.Create( "AAAAA" ); sampler.Begin(); // ... sampler.End(); } } CustomSampler…
リンク
概要 using UnityEngine; public class Example : MonoBehaviour { private void Update() { Physics.autoSimulation = false; Physics2D.autoSimulation = false; } } 物理演算を無効化する場合は 3D の場合は Physics.autoSimulation に false を、 2D の…
概要 using System.IO; using UnityEditor; using UnityEngine; [InitializeOnLoad] public static class Example { private const string PATH = "Library/Example"; static Example() { if ( File.Exists( PATH ) ) { Debug.Log( "2回目以降の起動" ); ret…
概要 using System.Linq; using UnityEditor; [InitializeOnLoad] public static class Example { static Example() { EditorBuildSettings.sceneListChanged += OnChanged; } private static void OnChanged() { var scenes = EditorBuildSettings.scenes; …
概要 using UnityEditor; [InitializeOnLoad] public static class Example { private const BuildTargetGroup DEFAULT_BUILD_TARGET_GROUP = BuildTargetGroup.Standalone; static Example() { EditorApplication.update += OnUpdate; } private static voi…
概要 Fork メニューの「File > Preferences...」から 「Git」タブの「Change the avatar at gravatar.com」のリンクを選択して 表示された上記のサイトでアカウントを作成して アカウント設定の画面にプロフィール画像をアップロードする そして Fork を再起…
概要 using UnityEditor; using UnityEngine; public class Example { [MenuItem( "Tools/Hoge" )] private static void Hoge() { var go = GameObject.Find( "Cube" ); var path = PrefabUtility.GetPrefabAssetPathOfNearestInstanceRoot( go ); Debug.Log…
ソースコード using UnityEngine; public sealed class Curve01Attribute : PropertyAttribute { } using UnityEditor; using UnityEngine; [CustomPropertyDrawer( typeof( Curve01Attribute ) )] public sealed class Curve01Drawer : PropertyDrawer { pu…
概要 MissingReferenceException: The object of type 'XXXX' has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object. DOTween を使っているシーンで他のシーン…
検証用スクリプト using System; using System.Collections.Concurrent; using System.Diagnostics; using System.Threading.Tasks; internal static class Program { private static void Main() { var count = 1000000000; var rangePartitioner = Partiti…
概要 using UnityEngine; using UnityEngine.EventSystems; public class Example : MonoBehaviour, IPointerClickHandler { public void OnPointerClick( PointerEventData eventData ) { if ( eventData.button == PointerEventData.InputButton.Right ) {…
ソースコード using JetBrains.Annotations; using System.Collections.Generic; public static class SourceTemplates { [SourceTemplate] [Macro( Target = "index" )] [Macro( Target = "value" )] public static void forArray<T>( this T[] self ) { for (</t>…