Performance: Why C# powers Unity behavior
MEDIUM IMPACT
This affects how quickly game logic runs and how smoothly the game responds to player input.
using UnityEngine;
public class PlayerController : MonoBehaviour {
void Update() {
Move();
}
void Move() {
// Movement logic
}
}using UnityEngine; public class PlayerController : MonoBehaviour { void Update() { // Using slow reflection or dynamic calls inside Update var method = GetType().GetMethod("Move"); method?.Invoke(this, null); } void Move() { // Movement logic } }
| Pattern | CPU Usage | Frame Drops | Memory Allocations | Verdict |
|---|---|---|---|---|
| Reflection in Update loop | High | Frequent | High | [X] Bad |
| Direct method calls in Update | Low | Rare | Low | [OK] Good |