0
0
Unityframework~8 mins

New Input System overview in Unity - Performance & Optimization

Choose your learning style9 modes available
Performance: New Input System overview
MEDIUM IMPACT
This affects how quickly and efficiently user inputs are processed and how responsive the game feels.
Handling player input in a Unity game
Unity
void OnEnable() {
  var playerInput = new PlayerInput();
  playerInput.Player.Jump.performed += ctx => Jump();
  playerInput.Enable();
}
Uses event-driven input handling that triggers only on input events, reducing unnecessary checks.
📈 Performance GainNon-blocking input processing; reduces CPU usage and improves input responsiveness.
Handling player input in a Unity game
Unity
void Update() {
  if (Input.GetKeyDown(KeyCode.Space)) {
    Jump();
  }
}
Uses the old Input class which polls input every frame and can cause missed inputs or lag in complex scenes.
📉 Performance CostBlocks input processing until Update runs; can cause input lag especially with many objects.
Performance Comparison
PatternInput ChecksCPU UsageInput LagVerdict
Old Input.GetKeyDown pollingRuns every frameHigher due to constant pollingHigher due to frame delay[X] Bad
New Input System event callbacksRuns only on input eventsLower due to event-driven modelLower due to immediate event handling[OK] Good
Rendering Pipeline
Input events are captured asynchronously and dispatched to listeners without blocking the main game loop, improving responsiveness.
Input Processing
Game Logic Update
⚠️ BottleneckPolling input every frame in Update causes delays and missed inputs.
Core Web Vital Affected
INP
This affects how quickly and efficiently user inputs are processed and how responsive the game feels.
Optimization Tips
1Avoid polling inputs every frame; use event callbacks instead.
2Enable input actions only when needed to save CPU.
3Use the Profiler to monitor input processing times for responsiveness.
Performance Quiz - 3 Questions
Test your performance knowledge
What is a key performance advantage of the New Input System over the old Input class in Unity?
AIt uses event-driven input handling instead of polling every frame.
BIt requires less memory for storing input states.
CIt automatically optimizes graphics rendering.
DIt reduces the size of the game build.
DevTools: Profiler
How to check: Open Unity Profiler, record while playing, look at CPU usage and input event handling times.
What to look for: Lower CPU time spent in input processing and faster response to input events indicate good performance.