一:Debug.Log产生GC

Debug.Log会产生GC,如果一帧log太多次会影响性能,建议上线后使用Debug.unityLogger.logEnabled = false禁用掉所有log

private void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
for (int i = 0; i < 9999; i++)
{
Debug.Log("log");
}
}
}

二: