From 1e067a01fabce9e99938a59c8e6c1ac72d824486 Mon Sep 17 00:00:00 2001 From: Christopher Date: Tue, 24 Jan 2017 12:54:55 +0000 Subject: [PATCH] Fixed Say text appears for single frame when using Say command #575 --- Assets/Fungus/Scripts/Components/Writer.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Assets/Fungus/Scripts/Components/Writer.cs b/Assets/Fungus/Scripts/Components/Writer.cs index ec23393f..956652b3 100644 --- a/Assets/Fungus/Scripts/Components/Writer.cs +++ b/Assets/Fungus/Scripts/Components/Writer.cs @@ -130,15 +130,20 @@ namespace Fungus writerListeners.Add(writerListener); } } + + CacheHiddenColorStrings(); } - protected virtual void Start() + protected virtual void CacheHiddenColorStrings() { // Cache the hidden color string Color32 c = hiddenTextColor; hiddenColorOpen = String.Format("", c.r, c.g, c.b, c.a); hiddenColorClose = ""; + } + protected virtual void Start() + { if (forceRichText) { if (textUI != null) @@ -587,6 +592,12 @@ namespace Fungus if (SupportsRichText() && rightString.Length > 0) { + // Ensure the hidden color strings are populated + if (hiddenColorOpen.Length == 0) + { + CacheHiddenColorStrings(); + } + outputString.Append(hiddenColorOpen); outputString.Append(rightString); outputString.Append(hiddenColorClose);