private void CancellableGoto(System.Threading.CancellationToken cancellationToken) { //index = Mathf.Clamp(index, 0, demoParser.Header.PlaybackFrames); RemoveListeners(demoParser); if (demoParser.CurrentTick > tickIndex) { demoParser.GotoStart(); } while (demoParser.CurrentTick != tickIndex && !cancellationToken.IsCancellationRequested) { demoParser.ParseNextTick(); if (demoParser.CurrentTick > tickIndex) { demoParser.GotoStart(); } } AddListeners(demoParser); }