Performance: Tags and layers
MEDIUM IMPACT
Tags and layers affect how Unity filters and processes game objects during rendering and physics calculations, impacting frame rate and responsiveness.
if (((1 << other.gameObject.layer) & enemyLayerMask) != 0) { /* process collision */ }
if (other.gameObject.tag == "Enemy") { /* process collision */ }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Using string tags for filtering | N/A | N/A | N/A | [X] Bad |
| Using layer masks for filtering | N/A | N/A | N/A | [OK] Good |