fix(ui): 修复单行对话框未激活时空引用

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-10 22:33:28 +08:00
co-authored by Cursor
parent 024eecb404
commit 2792d8fafa
+4 -1
View File
@@ -39,10 +39,13 @@ namespace AibisDream
syncToken.SkipTextAnima += () => content.SkipTypewriter(); syncToken.SkipTextAnima += () => content.SkipTypewriter();
syncToken.OnAdvance += AfterAdvance; syncToken.OnAdvance += AfterAdvance;
// TMP ClearMesh 依赖 canvasRendererbox 未激活时 SetText 会 NRE
if (box != null && !box.activeSelf)
box.SetActive(true);
// 播放文字 // 播放文字
content.TextAnimator.SetText(string.Empty); content.TextAnimator.SetText(string.Empty);
var lineText = GetOneLineText(syncToken.lineInfo); var lineText = GetOneLineText(syncToken.lineInfo);
box.SetActive(true);
HandleLayout(lineText); HandleLayout(lineText);
content.ShowText(lineText); content.ShowText(lineText);
syncToken.TextStart(); syncToken.TextStart();