Skip to content

Commit 4cca2fb

Browse files
committed
fix: flickering issue when scale Y changes when used ShadowMode with TextMeshPro
close #367
1 parent d1adb33 commit 4cca2fb

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Packages/src/Runtime/Internal/Utilities/UIExtraCallbacks.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using UnityEditor;
33
using UnityEngine;
44
using UnityEngine.UI;
5+
using System.Reflection;
56

67
namespace Coffee.UIEffectInternal
78
{
@@ -67,7 +68,15 @@ private static void InitializeAfterCanvasRebuild()
6768
if (s_IsInitializedAfterCanvasRebuild) return;
6869
s_IsInitializedAfterCanvasRebuild = true;
6970

71+
// Explicitly set `Canvas.willRenderCanvases += CanvasUpdateRegistry.PerformUpdate`.
7072
CanvasUpdateRegistry.IsRebuildingLayout();
73+
#if TMP_ENABLE
74+
// Explicitly set `Canvas.willRenderCanvases += TMP_UpdateManager.DoRebuilds`.
75+
typeof(TMPro.TMP_UpdateManager)
76+
.GetProperty("instance", BindingFlags.NonPublic | BindingFlags.Static)
77+
.GetValue(null);
78+
#endif
79+
Canvas.willRenderCanvases -= OnAfterCanvasRebuild;
7180
Canvas.willRenderCanvases += OnAfterCanvasRebuild;
7281
Logging.LogMulticast(typeof(Canvas), "willRenderCanvases",
7382
message: "InitializeAfterCanvasRebuild");

0 commit comments

Comments
 (0)