private void Update() { if (musicSource != null) { musicSource.volume = volume; } if (VirtualKey.GetKeyDown(VK.VK_MEDIA_STOP) || KeyCodeUtils.GetKeyDown(Config.StopKey)) { stopped = true; paused = false; Stop(); } if (VirtualKey.GetKeyDown(VK.VK_MEDIA_PLAY_PAUSE) || KeyCodeUtils.GetKeyDown(Config.PlayPauseKey)) { if (!stopped) { Pause(); } else { stopped = false; paused = false; timeOfLastMusic = Time.time; var filename = OST.Concat(CustomMusic).First(x => x.Value == musicSource.clip).Key; musicSource.Play(); } } if (VirtualKey.GetKeyDown(VK.VK_MEDIA_NEXT_TRACK) || KeyCodeUtils.GetKeyDown(Config.NextTrackKey)) { NextTrack(); } if (VirtualKey.GetKeyDown(VK.VK_MEDIA_PREV_TRACK) || KeyCodeUtils.GetKeyDown(Config.PreviousTrackKey)) { if (CurrentTrackIndex > 0 && Time.time - timeOfLastMusic <= 1) { PreviousTrack(); } else { Stop(); timeOfLastMusic = Time.time; var filename = OST.Concat(CustomMusic).First(x => x.Value == musicSource.clip).Key; musicSource.Play(); } } }