EllanJiang/GameFramework · error · GameFrameworkException

Can not find UI form info for serial id

Error message

Can not find UI form info for serial id '{0}', UI form asset name is '{1}'.

What it means

RemoveUIForm (invoked when closing a UI form) first looks up the group's internal UIFormInfo record for the given IUIForm. If no record matches the form's serial id and asset name, it throws GameFrameworkException with both identifiers, indicating the form is not tracked by this group.

Solutions

  1. Check uiForm.IsValid / CloseUIForm return semantics; track open state yourself and skip closes of already-closed forms
  2. Verify the form belongs to the expected UIGroup before closing
  3. Null out cached IUIForm references after closing

Example fix

// before
uiGroup.CloseUIForm(cachedForm); // may throw if already closed
// after
if (cachedForm != null && m_OpenFormIds.Contains(cachedForm.SerialId))
{
    uiGroup.CloseUIForm(cachedForm);
    m_OpenFormIds.Remove(cachedForm.SerialId);
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (uiForm == null || !m_OpenFormSerialIds.Contains(uiForm.SerialId)) return;

Type guard

bool IsTrackedForm(IUIForm form) => form != null && m_OpenFormSerialIds.Contains(form.SerialId);

Try / catch

try { uiGroup.CloseUIForm(uiForm); m_OpenFormSerialIds.Remove(uiForm.SerialId); } catch (GameFrameworkException ex) { Log.Warn($"CloseUIForm skipped: {ex.Message}"); }

Prevention

When it happens

Trigger: Calling CloseUIForm with a form instance that was never opened in this group; closing a form that was already closed (double close); closing a form opened in a different UIGroup.

Common situations: Double-close from both a UI button and a timeout/path; caching an IUIForm reference after its form was closed; scene/group rebuilds invalidating old references.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15). Data as JSON: /api/errors/d6120f03cfa6c167. Report an issue: GitHub.

Appendix: source

Thrown at GameFramework/UI/UIManager.UIGroup.cs:345

            /// <summary>
            /// 往界面组增加界面。
            /// </summary>
            /// <param name="uiForm">要增加的界面。</param>
            public void AddUIForm(IUIForm uiForm)
            {
                m_UIFormInfos.AddFirst(UIFormInfo.Create(uiForm));
            }

            /// <summary>
            /// 从界面组移除界面。
            /// </summary>
            /// <param name="uiForm">要移除的界面。</param>
            public void RemoveUIForm(IUIForm uiForm)
            {
                UIFormInfo uiFormInfo = GetUIFormInfo(uiForm);
                if (uiFormInfo == null)
                {
                    throw new GameFrameworkException(Utility.Text.Format("Can not find UI form info for serial id '{0}', UI form asset name is '{1}'.", uiForm.SerialId, uiForm.UIFormAssetName));
                }

                if (!uiFormInfo.Covered)
                {
                    uiFormInfo.Covered = true;
                    uiForm.OnCover();
                }

                if (!uiFormInfo.Paused)
                {
                    uiFormInfo.Paused = true;
                    uiForm.OnPause();
                }

                if (m_CachedNode != null && m_CachedNode.Value.UIForm == uiForm)
                {
                    m_CachedNode = m_CachedNode.Next;
                }

View on GitHub (pinned to d0c010b051)