From 54d9d396cdc1a82368ea4bbba49fccb106c94f8b Mon Sep 17 00:00:00 2001 From: Steve Halliwell Date: Sun, 6 Jun 2021 07:37:21 +1000 Subject: [PATCH] Cherry-pick WriterAudio.GetSecondsRemaining Now on completion of the voice over clip the number of seconds remaining is 0 --- Assets/Fungus/Docs/CHANGELOG.txt | 1 + Assets/Fungus/Scripts/Components/WriterAudio.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Assets/Fungus/Docs/CHANGELOG.txt b/Assets/Fungus/Docs/CHANGELOG.txt index fd5ef1ed..3a7d305a 100644 --- a/Assets/Fungus/Docs/CHANGELOG.txt +++ b/Assets/Fungus/Docs/CHANGELOG.txt @@ -9,6 +9,7 @@ Unreleased ## Changed - Block will LogError when an exception is caught from a Command being Executed. + - WriterAudio.GetSecondsRemaining reports 0 if not playing. Thanks to KVinS. v3.13.6 ====== diff --git a/Assets/Fungus/Scripts/Components/WriterAudio.cs b/Assets/Fungus/Scripts/Components/WriterAudio.cs index b5162ca6..e751ef92 100644 --- a/Assets/Fungus/Scripts/Components/WriterAudio.cs +++ b/Assets/Fungus/Scripts/Components/WriterAudio.cs @@ -63,7 +63,7 @@ namespace Fungus { if (IsPlayingVoiceOver) { - return targetAudioSource.clip.length - targetAudioSource.time; + return targetAudioSource.isPlaying ? targetAudioSource.clip.length - targetAudioSource.time : 0f; } else {