From 4b1c6ce4fd6bd5c0eee2fd3b0ef87cedad3064f2 Mon Sep 17 00:00:00 2001 From: FrancescoWeik Date: Thu, 25 Jan 2024 15:55:48 +0100 Subject: [PATCH 1/2] Fixed internalUpdate error --- Scripts/Runtime/TMPro_Private.cs | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/Scripts/Runtime/TMPro_Private.cs b/Scripts/Runtime/TMPro_Private.cs index e47fed0..5280390 100644 --- a/Scripts/Runtime/TMPro_Private.cs +++ b/Scripts/Runtime/TMPro_Private.cs @@ -1473,18 +1473,26 @@ internal override void InternalUpdate() // We need to update the SDF scale or possibly regenerate the text object if lossy scale has changed. if (m_havePropertiesChanged == false) { - float lossyScaleY = m_rectTransform.lossyScale.y; - - // Ignore very small lossy scale changes as their effect on SDF Scale would not be visually noticeable. - // Do not update SDF Scale if the text is null or empty - if (Mathf.Abs(lossyScaleY - m_previousLossyScaleY) > 0.0001f && m_TextProcessingArray[0].unicode != 0) + if (m_rectTransform) { - float scaleDelta = lossyScaleY / m_previousLossyScaleY; + float lossyScaleY = m_rectTransform.lossyScale.y; + + // Ignore very small lossy scale changes as their effect on SDF Scale would not be visually noticeable. + // Do not update SDF Scale if the text is null or empty + if (Mathf.Abs(lossyScaleY - m_previousLossyScaleY) > 0.0001f && m_TextProcessingArray[0].unicode != 0) + { + float scaleDelta = lossyScaleY / m_previousLossyScaleY; - UpdateSDFScale(scaleDelta); + UpdateSDFScale(scaleDelta); - m_previousLossyScaleY = lossyScaleY; + m_previousLossyScaleY = lossyScaleY; + } + } + else + { + Debug.LogError("the element m_rectTransform is null, added else otherwise the texts disappeared"); } + } // Added to handle legacy animation mode. From 85caabbf060669c02a5a10e254601fdcb1ae4862 Mon Sep 17 00:00:00 2001 From: FrancescoWeik Date: Thu, 1 Feb 2024 14:31:12 +0100 Subject: [PATCH 2/2] Update The description of the fix --- Scripts/Runtime/TMPro_Private.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Scripts/Runtime/TMPro_Private.cs b/Scripts/Runtime/TMPro_Private.cs index 5280390..5686140 100644 --- a/Scripts/Runtime/TMPro_Private.cs +++ b/Scripts/Runtime/TMPro_Private.cs @@ -1490,7 +1490,16 @@ internal override void InternalUpdate() } else { - Debug.LogError("the element m_rectTransform is null, added else otherwise the texts disappeared"); + + /* + AnotheReality: we added a debug log warning just to check where the TMPro error was occurring + if you see this warning then it means that the texts were previously disappearing at this point but now they don't anymore + we simply added a check to the m_rectTransform that was returning null and because of that the texts were disappearing + */ + + if(Application.isPlaying){ + Debug.LogWarning("AnotheReality: this check was added to avoid the TMPro error where the texts were disappearing"); + } } }