{"record":{"id":"320c5d1126ec382a","repo":"EllanJiang/GameFramework","slug":"can-not-load-binary-0-from-file-system-which-is-not-use-file","errorCode":null,"errorMessage":"Can not load binary '{0}' from file system which is not use file system.","messagePattern":"Can not load binary '(.+?)' from file system which is not use file system\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Resource/ResourceManager.ResourceLoader.cs","lineNumber":638,"sourceCode":"                ResourceInfo resourceInfo = GetResourceInfo(binaryAssetName);\n                if (resourceInfo == null)\n                {\n                    throw new GameFrameworkException(Utility.Text.Format(\"Can not load binary '{0}' from file system which is not exist.\", binaryAssetName));\n                }\n\n                if (!resourceInfo.Ready)\n                {\n                    throw new GameFrameworkException(Utility.Text.Format(\"Can not load binary '{0}' from file system which is not ready.\", binaryAssetName));\n                }\n\n                if (!resourceInfo.IsLoadFromBinary)\n                {\n                    throw new GameFrameworkException(Utility.Text.Format(\"Can not load binary '{0}' from file system which is not a binary asset.\", binaryAssetName));\n                }\n\n                if (!resourceInfo.UseFileSystem)\n                {\n                    throw new GameFrameworkException(Utility.Text.Format(\"Can not load binary '{0}' from file system which is not use file system.\", binaryAssetName));\n                }\n\n                IFileSystem fileSystem = m_ResourceManager.GetFileSystem(resourceInfo.FileSystemName, resourceInfo.StorageInReadOnly);\n                byte[] bytes = fileSystem.ReadFile(resourceInfo.ResourceName.FullName);\n                if (bytes == null)\n                {\n                    return null;\n                }\n\n                if (resourceInfo.LoadType == LoadType.LoadFromBinaryAndQuickDecrypt || resourceInfo.LoadType == LoadType.LoadFromBinaryAndDecrypt)\n                {\n                    DecryptResourceCallback decryptResourceCallback = m_ResourceManager.m_DecryptResourceCallback ?? DefaultDecryptResourceCallback;\n                    decryptResourceCallback(bytes, 0, bytes.Length, resourceInfo.ResourceName.Name, resourceInfo.ResourceName.Variant, resourceInfo.ResourceName.Extension, resourceInfo.StorageInReadOnly, resourceInfo.FileSystemName, (byte)resourceInfo.LoadType, resourceInfo.Length, resourceInfo.HashCode);\n                }\n\n                return bytes;\n            }\n","sourceCodeStart":620,"sourceCodeEnd":656,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Resource/ResourceManager.ResourceLoader.cs#L620-L656","documentation":"The resource is a binary asset but ResourceInfo.UseFileSystem is false — this binary was packaged as a loose file on disk, not packed into an (encrypted/packed) file system. LoadBinaryFromFileSystem only reads resources stored inside a file system, so it throws.","triggerScenarios":"Calling LoadBinaryFromFileSystem on a binary whose packaging option put it outside any file system (default 'not use file system' packaging), e.g. binaries stored as separate files in read-only/read-write path.","commonSituations":"The resource package was built without file-system packing for that binary, but the code assumes the packed path; switching packaging settings between builds without updating load code.","solutions":["Enable file-system packing for the binary in the resource build settings and rebuild the package.","Or load it via the regular LoadBinary (which handles non-file-system binaries via ResourceHelper.LoadBytes) instead of LoadBinaryFromFileSystem.","Check UseFileSystem beforehand if you can access resource metadata, and choose the loading path accordingly.","Wrap in try-catch for GameFrameworkException and fall back to LoadBinary."],"exampleFix":"// before\nbyte[] bytes = m_ResourceComponent.LoadBinaryFromFileSystem(binaryName); // binary stored as loose file\n// after\nm_ResourceComponent.LoadBinary(binaryName, new LoadBinaryCallbacks(OnLoadBinarySuccess, OnLoadBinaryFailure), userData);","handlingStrategy":"fallback","validationCode":"// read via LoadBinaryFromFileSystem only when the binary is packed in a file system\nif (PackingConfig.UseFileSystemFor(binaryName) == false)\n{\n    m_ResourceComponent.LoadBinary(binaryName, callbacks, userData);\n    return;\n}","typeGuard":"bool IsPackedInFileSystem(string name) => PackingConfig.UseFileSystemFor(name);","tryCatchPattern":"try { bytes = m_ResourceComponent.LoadBinaryFromFileSystem(binaryName); }\ncatch (GameFrameworkException ex) when (ex.Message.Contains(\"not use file system\"))\n{ m_ResourceComponent.LoadBinary(binaryName, callbacks, userData); }","preventionTips":["Keep packaging mode (file system vs loose files) and loading code in sync.","Document which binaries are packed into file systems per build profile.","Centralize binary loading in one helper that supports both paths.","Test reads against both packaging configurations in CI."],"tags":["gameframework","resource","filesystem","binary","packaging"],"backgroundTag":"unsupported-operation","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"}