This commit is contained in:
陈思海 2025-12-16 17:08:10 +08:00
parent 4546da4928
commit f6715dbfae
2 changed files with 5 additions and 1 deletions

View File

@ -147,6 +147,7 @@ namespace UnityEngine.UI
// 检查是否找不到对应 ID 的 key
if (localizationID.intValue > 0 && !allTableNames.ContainsKey(localizationID.intValue))
{
m_localizationKey.stringValue = string.Empty;
EditorGUILayout.HelpBox($"已选择的多语言 Key (ID={localizationID.intValue}) 已被删除,但仍然保留该 ID。", MessageType.Warning);
}

View File

@ -12,7 +12,10 @@ namespace UnityEngine.UI
protected override void OnValidate()
{
base.OnValidate();
if (!Application.isPlaying) text = LocalizationRefreshHelper.GetPreviewLabel(m_localizationKey);
if (!Application.isPlaying && !string.IsNullOrEmpty(m_localizationKey))
{
text = LocalizationRefreshHelper.GetPreviewLabel(m_localizationKey);
}
}
#endif
protected override void Start()