I’m running into a consistent issue which suggests I don’t understand something going on under the hood. I’m profiling my game on my android device and trying to sort out any spikes. Here’s my issue:
- Across several different coroutines (regardless of which coroutine and what’s in the coroutine), most of the time the coroutine runs fine, no spikes, all is well.
- A significant percentage of the time though, the coroutine profiles differently, and under the coroutine I get File.Read, File.Open, File.Seek. See screen shot.
To reiterate, most of the time my coroutines run normal, no spikes, I don’t see any File.X references. Occasionally though, I see the same coroutine run, a spike, and every time I see the spike, I see the File.X reference under the coroutine, regardless of which coroutine it is in my game.
Anyone have any idea what’s happening? GC? Spikes are anywhere from the 18ms to 40ms variety, so really significant in a game that otherwise runs at 60fps.
Here’s the profiled coroutine, but like I said, it seems to be systemic to every coroutine in my game (I chose this one since it’s the simplest coroutine and I still see this happen)?!
IEnumerator CountDown()
{
countDownText.text = "3";
audioSource.PlayOneShot(countDownSound);
yield return new WaitForSeconds(1);
countDownText.text = "2";
audioSource.PlayOneShot(countDownSound);
yield return new WaitForSeconds(1);
countDownText.text = "1";
audioSource.PlayOneShot(countDownSound);
yield return new WaitForSeconds(1);
countDownText.text = "!";
audioSource.PlayOneShot(gameStartSound);
matchStarted = true;
yield return new WaitForSeconds(1);
countDownText.text = "";
}
Any help is greatly appreciated! Just a few more spikes until this guys running happily!
