Skip to content

Commit

Permalink
Fix exception when trying to instantiate text too early or too late
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoco007 committed Mar 22, 2024
1 parent 86e7bec commit 9bbbba1
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static bool Prefix(ref Shader __result)
{
if (ShaderUtilities.k_ShaderRef_MobileSDF == null)
{
ShaderUtilities.k_ShaderRef_MobileSDF = Resources.FindObjectsOfTypeAll<Shader>().First(s => s.name == "TextMeshPro/Mobile/Distance Field");
ShaderUtilities.k_ShaderRef_MobileSDF = Resources.FindObjectsOfTypeAll<Shader>().FirstOrDefault(s => s.name == "TextMeshPro/Mobile/Distance Field");
}

__result = ShaderUtilities.k_ShaderRef_MobileSDF;
Expand All @@ -28,7 +28,7 @@ public static void Postfix()
{
if (TMP_Settings.s_Instance.m_defaultFontAsset == null)
{
TMP_Settings.s_Instance.m_defaultFontAsset = Resources.FindObjectsOfTypeAll<TMP_FontAsset>().First(f => f.name == "Teko-Medium SDF");
TMP_Settings.s_Instance.m_defaultFontAsset = Resources.FindObjectsOfTypeAll<TMP_FontAsset>().FirstOrDefault(f => f.name == "Teko-Medium SDF");
}
}
}
Expand Down

0 comments on commit 9bbbba1

Please sign in to comment.