{"record":{"id":"a84db9493b98de34","repo":"EllanJiang/GameFramework","slug":"verify-resources-complete-callback-is-invalid","errorCode":null,"errorMessage":"Verify resources complete callback is invalid.","messagePattern":"Verify resources complete callback is invalid\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Resource/ResourceManager.cs","lineNumber":1183,"sourceCode":"            if (m_VersionListProcessor == null)\n            {\n                throw new GameFrameworkException(\"You can not use UpdateVersionList at this time.\");\n            }\n\n            m_UpdateVersionListCallbacks = updateVersionListCallbacks;\n            m_VersionListProcessor.UpdateVersionList(versionListLength, versionListHashCode, versionListCompressedLength, versionListCompressedHashCode);\n        }\n\n        /// <summary>\n        /// 使用可更新模式并校验资源。\n        /// </summary>\n        /// <param name=\"verifyResourceLengthPerFrame\">每帧至少校验资源的大小，以字节为单位。</param>\n        /// <param name=\"verifyResourcesCompleteCallback\">使用可更新模式并校验资源完成时的回调函数。</param>\n        public void VerifyResources(int verifyResourceLengthPerFrame, VerifyResourcesCompleteCallback verifyResourcesCompleteCallback)\n        {\n            if (verifyResourcesCompleteCallback == null)\n            {\n                throw new GameFrameworkException(\"Verify resources complete callback is invalid.\");\n            }\n\n            if (m_ResourceMode == ResourceMode.Unspecified)\n            {\n                throw new GameFrameworkException(\"You must set resource mode first.\");\n            }\n\n            if (m_ResourceMode != ResourceMode.Updatable && m_ResourceMode != ResourceMode.UpdatableWhilePlaying)\n            {\n                throw new GameFrameworkException(\"You can not use VerifyResources without updatable resource mode.\");\n            }\n\n            if (m_RefuseSetFlag)\n            {\n                throw new GameFrameworkException(\"You can not verify resources at this time.\");\n            }\n\n            m_ResourceVerifier = new ResourceVerifier(this);","sourceCodeStart":1165,"sourceCodeEnd":1201,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Resource/ResourceManager.cs#L1165-L1201","documentation":"Thrown by ResourceManager.VerifyResources when the verifyResourcesCompleteCallback parameter is null. The manager requires a callback so it can report verification results (success/failure counts) when resource verification finishes, and refuses to start without one.","triggerScenarios":"Calling VerifyResources(int, VerifyResourcesCompleteCallback) with a null callback, e.g. resourceManager.VerifyResources(1024 * 1024, null) or passing an uninitialized delegate variable.","commonSituations":"Forgetting to hook the verification-complete handler in the update pipeline; refactoring code that removed the callback subscription; conditional logic that only assigns the callback in one branch.","solutions":["Pass a non-null VerifyResourcesCompleteCallback delegate, even if it only logs the result.","Check that the callback variable is assigned before calling VerifyResources.","Wrap the call in try-catch for GameFrameworkException to surface the configuration mistake early."],"exampleFix":"// before\nm_ResourceManager.VerifyResources(1024 * 1024, null);\n// after\nm_ResourceManager.VerifyResources(1024 * 1024, OnVerifyResourcesComplete);\n\nprivate void OnVerifyResourcesComplete(int removedCount, int totalCount) { ... }","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["unity","gameframework","argument-validation","callback"],"backgroundTag":"null-argument","analyzedSha":"d0c010b05167c58e92350449d04864a91ca13fd2","analyzedAt":"2026-09-15T13:37:15.352Z","contentChangedAt":"2026-09-15T13:37:15.352Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}