Figure: Diagnostic workflow: Measure update overhead → Manage registration → Update active targets
Figure: Diagnostic workflow: Measure update overhead → Manage registration → Update active targets

Cause and mechanism

A MonoBehaviour's Update is called once per frame while it is active. With many objects, both the calls themselves and repeated checks that do no useful work can cost CPU time. Measure with the Profiler before and after collecting updates into one manager to see whether the change helps.

Check and correct the setup

  1. Register update targets and invoke only the necessary targets from one manager.
    Change one variable, then remeasure
    Change one variable, then remeasure
  2. Register on enable and unregister on disable. Unregister through an existing manager; do not create one during teardown.
    Change one variable, then remeasure
    Change one variable, then remeasure
  3. Defer structural changes during iteration, skip disabled targets immediately, and reset iteration state in finally.
    Change one variable, then remeasure
    Change one variable, then remeasure

Limits and verification

Removing empty callbacks or reducing update frequency may suffice. Compare CPU time before and after; performance gains depend on workload and device.

A focused diagnostic setup

Measure Update invocation overhead separately from the calculations inside it. First establish a baseline with unnecessary updates disabled.

Test in this order

  1. Compare zero, few and many active targets in CPU Timeline.
    Change one variable, then remeasure
    Change one variable, then remeasure
  2. Disable or destroy a target during iteration and verify deferred removal plus immediate activity checks prevent another call.
    Change one variable, then remeasure
    Change one variable, then remeasure
  3. Confirm shutdown/scene-exit unregistration never creates a replacement manager.
    Change one variable, then remeasure
    Change one variable, then remeasure

Interpret the result

Centralization does not remove each target’s heavy calculations. Verify duplicate registration, ordering dependencies and exception recovery while preserving behavior.

Related explanations

References