以下の内容はhttps://baba-s.hatenablog.com/entry/2019/04/15/152000より取得しました。


【Unity】デリゲートだと 112B の GC Alloc が発生するがローカル関数だと GC Alloc が発生しない

概要

using System;
using UnityEngine;
using UnityEngine.Profiling;

public class Test : MonoBehaviour
{
    private void Update()
    {
        var samplerA = CustomSampler.Create( "TEST A" );
        samplerA.Begin();

        Func<int, int> funcA = n => n + 1;
        funcA( 25 );

        samplerA.End();

        var samplerB = CustomSampler.Create( "TEST B" );
        samplerB.Begin();

        int funcB( int n ) => n + 1;
        funcB( 25 );

        samplerB.End();
    }
}

f:id:baba_s:20190415152054p:plain




以上の内容はhttps://baba-s.hatenablog.com/entry/2019/04/15/152000より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14