コガネブログ

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

2020-03-02から1日間の記事一覧

【Unity】DOTween で 対象のゲームオブジェクトが破棄されたら Tween も破棄する方法

概要 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 を使っているシーンで他のシーン…

【C#】Parallel.ForEach で Partitioner.Create を使用する場合の処理速度検証

C#

検証用スクリプト 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…

【Unity】IPointerClickHandler などで右クリックされたかどうかを確認する方法

概要 using UnityEngine; using UnityEngine.EventSystems; public class Example : MonoBehaviour, IPointerClickHandler { public void OnPointerClick( PointerEventData eventData ) { if ( eventData.button == PointerEventData.InputButton.Right ) {…

【ReSharper】配列やリストの for 文を簡単に記述できる Source Template

ソースコード 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>…