EllanJiang/GameFramework · error · GameFrameworkException

Can not find UI form info.

Error message

Can not find UI form info.

What it means

RefocusUIForm moves the given form's UIFormInfo to the front of the group's list and raises the refocus lifecycle event. It throws GameFrameworkException('Can not find UI form info.') when the form instance is not tracked by this group.

Solutions

  1. Only call RefocusUIForm with forms that are currently open in this specific group
  2. Check the form's validity/open state before refocusing
  3. Clear cached references when forms close

Example fix

// before
uiGroup.RefocusUIForm(cachedForm, userData); // cachedForm may be closed
// after
if (cachedForm != null && cachedForm.Id > 0 && m_OpenForms.Contains(cachedForm))
{
    uiGroup.RefocusUIForm(cachedForm, userData);
}
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

bool IsOpenInThisGroup(IUIForm form) => form != null && uiGroup.GetUIForms(form.UIFormAssetName).Contains(form);

Try / catch

try { uiGroup.RefocusUIForm(uiForm, userData); } catch (GameFrameworkException ex) { Log.Warn($"RefocusUIForm skipped: {ex.Message}"); }

Prevention

When it happens

Trigger: Calling UIGroup.RefocusUIForm with a form opened in another group; refocusing a form that was already closed; passing a form whose SerialId no longer exists in this group.

Common situations: Refocusing a cached form reference after the form was closed; group reassignment during hierarchy changes; refocus calls from stale dialog-manager bookkeeping.

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/32c0268a033e1836. Report an issue: GitHub.

Appendix: source

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

                if (!m_UIFormInfos.Remove(uiFormInfo))
                {
                    throw new GameFrameworkException(Utility.Text.Format("UI group '{0}' not exists specified UI form '[{1}]{2}'.", m_Name, uiForm.SerialId, uiForm.UIFormAssetName));
                }

                ReferencePool.Release(uiFormInfo);
            }

            /// <summary>
            /// 激活界面。
            /// </summary>
            /// <param name="uiForm">要激活的界面。</param>
            /// <param name="userData">用户自定义数据。</param>
            public void RefocusUIForm(IUIForm uiForm, object userData)
            {
                UIFormInfo uiFormInfo = GetUIFormInfo(uiForm);
                if (uiFormInfo == null)
                {
                    throw new GameFrameworkException("Can not find UI form info.");
                }

                m_UIFormInfos.Remove(uiFormInfo);
                m_UIFormInfos.AddFirst(uiFormInfo);
            }

            /// <summary>
            /// 刷新界面组。
            /// </summary>
            public void Refresh()
            {
                LinkedListNode<UIFormInfo> current = m_UIFormInfos.First;
                bool pause = m_Pause;
                bool cover = false;
                int depth = UIFormCount;
                while (current != null && current.Value != null)
                {
                    LinkedListNode<UIFormInfo> next = current.Next;

View on GitHub (pinned to d0c010b051)