Performance: Playing sound effects
MEDIUM IMPACT
This affects the responsiveness and smoothness of audio playback during gameplay, impacting user experience and interaction speed.
Use a pre-existing AudioSource component and call audioSource.PlayOneShot(soundEffectClip);AudioSource.PlayClipAtPoint(soundEffectClip, transform.position);
| Pattern | CPU Usage | Memory Allocations | Frame Drops | Verdict |
|---|---|---|---|---|
| PlayClipAtPoint (new AudioSource each time) | High | High | Likely | [X] Bad |
| PlayOneShot on reused AudioSource | Low | Minimal | Unlikely | [OK] Good |