I made this code
using UnityEngine;
public class InstanceTest : MonoBehaviour {
public int cnt; public bool startTest1 = false; public bool startTest2 = false;
void Update()
{
if (startTest1)
Test1(cnt);
if (startTest2)
Test2(cnt);
}
void Test1(int cnt)
{
float a;
for (int i = 0; i < cnt; i++)
a = 1f + 1f;
}
static void Test2(int cnt)
{
float a;
for (int i = 0; i < cnt; i++)
a = 1f + 1f;
}
}
On Profiler
why CPU Time on Update() hiccup when call Test1() and Test2() at first time?