From 1b19e38bc67cc8980ec1b2f56d9ff39a58450c1d Mon Sep 17 00:00:00 2001 From: in0finite Date: Thu, 7 May 2020 23:04:14 +0200 Subject: [PATCH] when stopping radio sound, save radio station's time only if audio source is playing --- Assets/Scripts/Behaviours/Vehicles/Vehicle_Radio.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/Behaviours/Vehicles/Vehicle_Radio.cs b/Assets/Scripts/Behaviours/Vehicles/Vehicle_Radio.cs index 794d5056..becfda06 100644 --- a/Assets/Scripts/Behaviours/Vehicles/Vehicle_Radio.cs +++ b/Assets/Scripts/Behaviours/Vehicles/Vehicle_Radio.cs @@ -131,7 +131,8 @@ namespace SanAndreasUnity.Behaviours.Vehicles m_isPlayingRadio = false; m_isWaitingForNewRadioSound = false; - if (m_currentRadioStationIndex >= 0) + // save current station's time + if (m_currentRadioStationIndex >= 0 && m_radioAudioSource.isPlaying) RadioStation.stations[m_currentRadioStationIndex].currentTime = m_radioAudioSource.time; m_radioAudioSource.Stop();