Performance: Component communication
MEDIUM IMPACT
This affects frame rate and responsiveness by how often and how many messages or events are sent between components during gameplay.
void Update() {
if (shouldAct) {
otherComponent.DoActionDirectly();
}
}void Update() {
otherComponent.SendMessage("DoAction");
}| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| SendMessage every frame | N/A | N/A | N/A | [X] Bad |
| Direct method calls on condition | N/A | N/A | N/A | [OK] Good |
| Events invoked every frame | N/A | N/A | N/A | [!] OK |
| Events invoked on state change | N/A | N/A | N/A | [OK] Good |