{"record":{"id":"6c4d72335117115b","repo":"EllanJiang/GameFramework","slug":"can-not-load-asset-0-which-is-a-binary-asset","errorCode":null,"errorMessage":"Can not load asset '{0}' which is a binary asset.","messagePattern":"Can not load asset '(.+?)' which is a binary asset\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Resource/ResourceManager.ResourceLoader.cs","lineNumber":331,"sourceCode":"                    if (loadAssetCallbacks.LoadAssetFailureCallback != null)\n                    {\n                        loadAssetCallbacks.LoadAssetFailureCallback(assetName, resourceInfo != null && !resourceInfo.Ready ? LoadResourceStatus.NotReady : LoadResourceStatus.NotExist, 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 asset '{0}' which is a binary asset.\", assetName);\n                    if (loadAssetCallbacks.LoadAssetFailureCallback != null)\n                    {\n                        loadAssetCallbacks.LoadAssetFailureCallback(assetName, LoadResourceStatus.TypeError, errorMessage, userData);\n                        return;\n                    }\n\n                    throw new GameFrameworkException(errorMessage);\n                }\n\n                LoadAssetTask mainTask = LoadAssetTask.Create(assetName, assetType, priority, resourceInfo, dependencyAssetNames, loadAssetCallbacks, userData);\n                foreach (string dependencyAssetName in dependencyAssetNames)\n                {\n                    if (!LoadDependencyAsset(dependencyAssetName, priority, mainTask, userData))\n                    {\n                        string errorMessage = Utility.Text.Format(\"Can not load dependency asset '{0}' when load asset '{1}'.\", dependencyAssetName, assetName);\n                        if (loadAssetCallbacks.LoadAssetFailureCallback != null)\n                        {\n                            loadAssetCallbacks.LoadAssetFailureCallback(assetName, LoadResourceStatus.DependencyError, errorMessage, userData);\n                            return;\n                        }\n\n                        throw new GameFrameworkException(errorMessage);\n                    }\n                }\n","sourceCodeStart":313,"sourceCodeEnd":349,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Resource/ResourceManager.ResourceLoader.cs#L313-L349","documentation":"LoadAsset found the asset in the resource info table but it is marked as loaded from binary; binary resources cannot be loaded as assets, and with no failure callback registered the error is thrown. Binary assets must be loaded through the binary APIs instead.","triggerScenarios":"Calling LoadAsset on an asset name whose resourceInfo.IsLoadFromBinary is true (e.g. a raw file/binary resource) while LoadAssetFailureCallback is null.","commonSituations":"Attempting to load non-asset raw files (config binaries, movies, textures packed as raw resources) through LoadAsset; misconfigured build rules that pack a serializable asset as binary.","solutions":["Use LoadBinary (or the binary load API) for binary resources instead of LoadAsset.","Fix the resource build configuration so the asset is packaged as an asset, not binary.","Pass a failure callback to handle the error gracefully.","Verify the asset name resolves to the intended asset, not a similarly named binary resource."],"exampleFix":"// before\nvar bin = resourceComponent.LoadAsset(\"Configs/data\", typeof(object), callbacks);\n// after\nbyte[] bytes = resourceComponent.LoadBinary(\"Configs/data\");","handlingStrategy":"validation","validationCode":"// Load binary resources through LoadBinary instead\nbyte[] data = resourceComponent.LoadBinary(resourceName);","typeGuard":null,"tryCatchPattern":"try { resourceComponent.LoadAsset(name, type, callbacksWithTypeError); }\ncatch (GameFrameworkException ex) { Log.Error(\"Binary asset via LoadAsset: \" + ex.Message); }","preventionTips":["Use LoadBinary for raw/binary resources","Verify build rules so assets are not packed as binary","Always supply a failure callback"],"tags":["gameframework","resource-management","asset-loading","binary-resource","type-mismatch"],"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"}