EllanJiang/GameFramework · error · GameFrameworkException

File system manager is invalid.

Error message

File system manager is invalid.

What it means

Thrown by ResourceManager.SetFileSystemManager when the IFileSystemManager argument is null. The file system manager is required for read/write path resource access; the library validates the argument immediately to avoid null references during resource operations.

Solutions

  1. Pass a valid IFileSystemManager, e.g. GameFrameworkEntry.GetModule<FileSystemManager>()
  2. Ensure the FileSystem module is created before resource initialization
  3. Add a null check before calling and log a configuration error

Example fix

// before
resourceManager.SetFileSystemManager(fileSystemManager); // may be null
// after
var fsm = GameFrameworkEntry.GetModule<FileSystemManager>();
resourceManager.SetFileSystemManager(fsm ?? throw new InvalidOperationException("FileSystemManager not initialized"));
Defensive patterns

Strategy: validation

Validate before calling

if (fileSystemManager == null) throw new InvalidOperationException("fileSystemManager must be created before SetFileSystemManager");

Type guard

bool IsValid(IFileSystemManager m) => m != null;

Try / catch

try { resourceManager.SetFileSystemManager(fileSystemManager); } catch (GameFrameworkException ex) { Debug.LogError($"Resource init failed: {ex.Message}"); }

Prevention

When it happens

Trigger: Calling SetFileSystemManager(null), or passing a variable that is null because the FileSystem module was not created or a GetComponent returned null.

Common situations: FileSystem module never registered with GameFrameworkEntry; Unity component setup order issue; DI wiring failed silently.

Related errors


AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15). Data as JSON: /api/errors/fd113268857df0a6. Report an issue: GitHub.

Appendix: source

Thrown at GameFramework/Resource/ResourceManager.cs:998

        public void SetObjectPoolManager(IObjectPoolManager objectPoolManager)
        {
            if (objectPoolManager == null)
            {
                throw new GameFrameworkException("Object pool manager is invalid.");
            }

            m_ResourceLoader.SetObjectPoolManager(objectPoolManager);
        }

        /// <summary>
        /// 设置文件系统管理器。
        /// </summary>
        /// <param name="fileSystemManager">文件系统管理器。</param>
        public void SetFileSystemManager(IFileSystemManager fileSystemManager)
        {
            if (fileSystemManager == null)
            {
                throw new GameFrameworkException("File system manager is invalid.");
            }

            m_FileSystemManager = fileSystemManager;
        }

        /// <summary>
        /// 设置下载管理器。
        /// </summary>
        /// <param name="downloadManager">下载管理器。</param>
        public void SetDownloadManager(IDownloadManager downloadManager)
        {
            if (downloadManager == null)
            {
                throw new GameFrameworkException("Download manager is invalid.");
            }

            if (m_VersionListProcessor != null)
            {

View on GitHub (pinned to d0c010b051)