diff --git a/assets/core/gui/layer/LayerNotify.ts b/assets/core/gui/layer/LayerNotify.ts index 74fe073..b5aa1d7 100644 --- a/assets/core/gui/layer/LayerNotify.ts +++ b/assets/core/gui/layer/LayerNotify.ts @@ -65,9 +65,11 @@ export class LayerNotify extends Node { * @param content 文本表示 * @param useI18n 是否使用多语言 */ - toast(content: string, useI18n: boolean) { + async toast(content: string, useI18n: boolean) { if (this.notify == null) { this.notify = ViewUtil.createPrefabNode(PromptResType.Toast); + // 兼容编辑器预览模式 + if (this.notify == null) this.notify = await ViewUtil.createPrefabNodeAsync(PromptResType.Toast); this.notifyItem = this.notify.children[0]; this.notifyItem.parent = null; }