Given Mod calc doesn't use index 0 on first pass through

frameCount will be 1 the first time you check it in your code so…
int frameNum = Time.frameCount % bufferSize;
1 % 100 = 1

and the first time you record a keyframe it will be at index 1 in the array.

if you use the calc below it seems to cycle between indexes 0 - 99

int frameNum = (Time.frameCount - 1) % bufferSize;

Privacy & Terms