{"record":{"id":"f0d318cca7d79b60","repo":"EllanJiang/GameFramework","slug":"ui-form-is-invalid","errorCode":null,"errorMessage":"UI form is invalid.","messagePattern":"UI form is invalid\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/UI/UIManager.UIGroup.UIFormInfo.cs","lineNumber":66,"sourceCode":"                }\n\n                public bool Covered\n                {\n                    get\n                    {\n                        return m_Covered;\n                    }\n                    set\n                    {\n                        m_Covered = value;\n                    }\n                }\n\n                public static UIFormInfo Create(IUIForm uiForm)\n                {\n                    if (uiForm == null)\n                    {\n                        throw new GameFrameworkException(\"UI form is invalid.\");\n                    }\n\n                    UIFormInfo uiFormInfo = ReferencePool.Acquire<UIFormInfo>();\n                    uiFormInfo.m_UIForm = uiForm;\n                    uiFormInfo.m_Paused = true;\n                    uiFormInfo.m_Covered = true;\n                    return uiFormInfo;\n                }\n\n                public void Clear()\n                {\n                    m_UIForm = null;\n                    m_Paused = false;\n                    m_Covered = false;\n                }\n            }\n        }\n    }","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/UI/UIManager.UIGroup.UIFormInfo.cs#L48-L84","documentation":"UIManager.UIGroup.UIFormInfo.Create wraps an IUIForm and throws when uiForm is null. UIFormInfo is the group's internal record of a live form; a null form would crash depth/pause/cover bookkeeping in the UIGroup linked list.","triggerScenarios":"UIGroup.AddUIForm (or direct UIFormInfo.Create usage) receives a null IUIForm — i.e. an instance object whose instantiated form is null, typically because the custom UI form helper's InstantiateUIForm returned null.","commonSituations":"Custom IUIFormHelper.InstantiateUIForm implementations returning null on failure instead of throwing; prefab with missing/incorrect root component; pool holding a cleared instance object.","solutions":["Fix the IUIFormHelper.InstantiateUIForm implementation so it never returns null — throw or log on failure.","Verify the UI form prefab has the script implementing IUIForm (UIFormLogic subclass) on its root.","Open forms through the standard OpenUIForm flow so assets load before instantiation."],"exampleFix":"// before\npublic object InstantiateUIForm(object uiFormAsset) { return null; }\n// after\npublic object InstantiateUIForm(object uiFormAsset)\n{\n    var go = Object.Instantiate((UnityEngine.Object)uiFormAsset) as GameObject;\n    if (go == null) throw new GameFrameworkException(\"InstantiateUIForm failed.\");\n    return go;\n}","handlingStrategy":"validation","validationCode":"if (uiForm == null)\n{\n    Log.Error(\"InstantiateUIForm returned null; cannot add to group\");\n    return;\n}","typeGuard":"bool IsValidForm(IUIForm f) => f != null && !string.IsNullOrEmpty(f.UIFormAssetName);","tryCatchPattern":"try { uiGroup.AddUIForm(uiForm); }\ncatch (GameFrameworkException ex) { Log.Error(ex, \"Null UI form handed to group\"); }","preventionTips":["IUIFormHelper.InstantiateUIForm must never return null — throw on failure","Ensure form prefabs carry the IUIForm-implementing root component","Open forms through the standard OpenUIForm pipeline"],"tags":["unity","gameframework","ui","null-argument"],"backgroundTag":"null-argument","analyzedSha":"d0c010b05167c58e92350449d04864a91ca13fd2","analyzedAt":"2026-09-15T13:37:15.352Z","contentChangedAt":"2026-09-15T13:37:15.352Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}