Search Issue Tracker
By Design
Votes
1
Found in
2019.1.0a9
2019.1.0f2
2019.2.0a1
Issue ID
1147478
Regression
Yes
AudioSource.PlayOneShot doesn't play sounds properly when there are a lot of animated sprites in the scene
Steps to repro:
1. Open original project "Sound_Bug_2019.1.zip"
2. Enter PlayMode and listen to the Audio
Expected result: Audio does not stutter.
Actual result: Audio stutters.
Reproduced in: 2019.1.0f2, 2019.2.0a13
Not reproduced in: 2018.3.14f1, 2019.1.0a8
-
arkogelul
Jun 14, 2019 11:40
Alright, but what I can see is that, over time, Unity becomes less capable of handling things. In previous versions, Unity was able to handle this (I agree) badly design setup just fine.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- [macOS] forward and backward mouse buttons are recognized as middle mouse button
- NavMeshModifier.OnEnable/OnDisable gets progressively slower when called repeatedly
- "System.Net.CookieContainer" throws an "ArgumentException" error when using a non-UTF-8 machine locale and hostname
- Crash on ModelImporter::ImportSkinnedMesh when disabling "Strip Bones" on a specific FBX model
- WebGL Development builds ignore the "Compression Format" setting when using "Gzip" compression
Resolution Note (2019.3.X):
This is simply because the large number of game objects causes a long Animators.Update (see Profiler) that ranges from 12-28 ms on a fast computer. Thus frames will be skipped, and there will therefore be less frequent frame updates than the code aims for with it's 20 ms throttling. Both Play and PlayOneShot are equally affected by this, and to make things worse the chosen "Best Performance" setting in the Audio Settings results in the largest DSP buffer used (4x as large as "Best latency"), so that further increases the likeliness of having large gaps between the frame update and the point at which the audio playback event is handled. If you want rock-solid timing of sub-frametime, you need to use PlayScheduled to trigger multiple events to occur during the next frame update, and as an AudioSource can only handle one scheduled playback event at a time, you need to delegate these out to multiple sources (from a pool so they can be reused efficiently).