Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.0.7 Fixed error on null reference #1

Open
wants to merge 2 commits into
base: 3.0.7
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 25 additions & 8 deletions Scripts/Runtime/TMPro_Private.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1473,18 +1473,35 @@ 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
{

/*
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");
}
}

}

// Added to handle legacy animation mode.
Expand Down