{"record":{"id":"78fa65b003b88cbf","repo":"EllanJiang/GameFramework","slug":"can-not-load-binary-0-which-is-not-a-binary-asset","errorCode":null,"errorMessage":"Can not load binary '{0}' which is not a binary asset.","messagePattern":"Can not load binary '(.+?)' which is not a binary asset\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Resource/ResourceManager.ResourceLoader.cs","lineNumber":599,"sourceCode":"                    if (loadBinaryCallbacks.LoadBinaryFailureCallback != null)\n                    {\n                        loadBinaryCallbacks.LoadBinaryFailureCallback(binaryAssetName, LoadResourceStatus.NotReady, errorMessage, userData);\n                        return;\n                    }\n\n                    throw new GameFrameworkException(errorMessage);\n                }\n\n                if (!resourceInfo.IsLoadFromBinary)\n                {\n                    string errorMessage = Utility.Text.Format(\"Can not load binary '{0}' which is not a binary asset.\", binaryAssetName);\n                    if (loadBinaryCallbacks.LoadBinaryFailureCallback != null)\n                    {\n                        loadBinaryCallbacks.LoadBinaryFailureCallback(binaryAssetName, LoadResourceStatus.TypeError, errorMessage, userData);\n                        return;\n                    }\n\n                    throw new GameFrameworkException(errorMessage);\n                }\n\n                if (resourceInfo.UseFileSystem)\n                {\n                    loadBinaryCallbacks.LoadBinarySuccessCallback(binaryAssetName, LoadBinaryFromFileSystem(binaryAssetName), 0f, userData);\n                }\n                else\n                {\n                    string path = Utility.Path.GetRemotePath(Path.Combine(resourceInfo.StorageInReadOnly ? m_ResourceManager.m_ReadOnlyPath : m_ResourceManager.m_ReadWritePath, resourceInfo.ResourceName.FullName));\n                    m_ResourceManager.m_ResourceHelper.LoadBytes(path, m_LoadBytesCallbacks, LoadBinaryInfo.Create(binaryAssetName, resourceInfo, loadBinaryCallbacks, userData));\n                }\n            }\n\n            /// <summary>\n            /// 从文件系统中加载二进制资源。\n            /// </summary>\n            /// <param name=\"binaryAssetName\">要加载二进制资源的名称。</param>\n            /// <returns>存储加载二进制资源的二进制流。</returns>","sourceCodeStart":581,"sourceCodeEnd":617,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Resource/ResourceManager.ResourceLoader.cs#L581-L617","documentation":"The resource name exists and is ready, but ResourceInfo.IsLoadFromBinary is false — the asset was packaged as an ordinary asset (scene/object, LoadType from assets) rather than a binary asset. LoadBinary refuses to return it and throws when no LoadBinaryFailureCallback is set.","triggerScenarios":"Calling LoadBinary/LoadBinaryAsync on an asset that was not placed in the binary resources list during packaging (e.g. a texture or text file not configured as binary in the resource editor).","commonSituations":"Developers assume any file can be loaded as binary; after reorganizing the resource package an asset moved from binary to normal assets; wrong asset name resolving to a different packaged resource.","solutions":["Mark the file as a binary resource in the GameFramework resource editor and repackage so its LoadType is LoadFromBinary.","If the asset is not meant to be binary, load it with LoadAsset instead of LoadBinary.","Double-check the binaryAssetName so it does not collide with a non-binary packaged resource.","Supply LoadBinaryFailureCallback to receive LoadResourceStatus.TypeError through the callback."],"exampleFix":"// before\nm_ResourceComponent.LoadBinary(\"Assets/GameAssets/UI/Logo.png\", callbacks, userData); // packaged as normal asset\n// after\n// In resource editor: add the file to binary resources, then:\nm_ResourceComponent.LoadBinary(\"Logo.png\", callbacks, userData);","handlingStrategy":"validation","validationCode":"// confirm the file is configured as a binary resource before calling\nDebug.Assert(IsRegisteredBinaryResource(binaryName), $\"{binaryName} must be marked as a binary resource in the resource editor.\");","typeGuard":"bool IsBinaryResource(string name) => BinaryResourceManifest.Contains(name);","tryCatchPattern":"try { m_ResourceComponent.LoadBinary(binaryName, callbacks, userData); }\ncatch (GameFrameworkException ex) when (ex.Message.Contains(\"not a binary asset\"))\n{ Log.Error(\"{0} is packaged as a normal asset; use LoadAsset instead.\", binaryName); }","preventionTips":["Maintain an explicit list of binary resources and generate load calls from it.","Verify packaging config (binary vs normal) in CI before builds.","Rename or namespace binary files so their names cannot collide with normal assets.","Re-run resource build when asset types change between versions."],"tags":["gameframework","resource","binary","type-error","packaging"],"backgroundTag":"incompatible-source-type","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"}