Performance: Debug.Log for debugging
MEDIUM IMPACT
Using Debug.Log affects the runtime performance by adding overhead during execution and can slow down frame rendering in Unity.
void Update() {
if (Input.GetKeyDown(KeyCode.L)) {
Debug.Log("Player position: " + transform.position);
}
}void Update() {
Debug.Log("Player position: " + transform.position);
}| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Logging every frame with Debug.Log | N/A | N/A | High CPU usage delays frame rendering | [X] Bad |
| Logging conditionally on input | N/A | N/A | Minimal CPU overhead, smooth frame rendering | [OK] Good |