EllanJiang/GameFramework · error · GameFrameworkException

Data asset ' ' is ' '.

Error message

Data asset '{0}' is '{1}'.

What it means

ReadData queries m_ResourceManager.HasAsset and switches on the HasAssetResult. Known cases (AssetOnDisk, BinaryOnFileSystem, etc.) are handled; any other result value falls into the default branch and throws this exception, reporting the asset name and the unexpected result value. It signals the resource manager returned a result the data provider does not know how to handle.

Solutions

  1. Log the reported result value from the exception message and confirm its meaning in HasAssetResult.
  2. Check the data asset name/path is correct and the asset exists in the current resource package.
  3. Synchronize ResourceManager and DataProvider source to the same GameFramework version.
  4. Re-export/refresh the resource package so the asset resolves to a known state.

Example fix

// before
dataProvider.ReadData("Assets/typo-config.dat", 0, null); // HasAssetResult.Unknown
// after
dataProvider.ReadData("Assets/Config/Config.dat", 0, null); // correct asset path
Defensive patterns

Strategy: try-catch

Validate before calling

if (m_ResourceManager.HasAsset(assetName) == HasAssetResult.Unknown) { /* fix asset path/package first */ }

Try / catch

try { dataProvider.ReadData(name, 0, null); }
catch (GameFrameworkException e) when (e.Message.StartsWith("Data asset")) { Log.Error("Unexpected HasAssetResult for '{0}': {1}", name, e.Message); }

Prevention

When it happens

Trigger: HasAsset(dataAssetName) returns an enum value outside the cases handled by ReadData — e.g. HasAssetResult.Unknown or a value added in a newer GameFramework version while DataProvider's switch was not updated.

Common situations: Assemblies or framework files from mismatched GameFramework versions (ResourceManager updated, DataProvider not); asset genuinely missing/unverifiable so the resource manager reports an 'unknown' state; typo in asset name causing a not-found-style result.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at GameFramework/Base/DataProvider/DataProvider.cs:244

                        }
                    }
                    catch (Exception exception)
                    {
                        if (m_ReadDataFailureEventHandler != null)
                        {
                            ReadDataFailureEventArgs loadDataFailureEventArgs = ReadDataFailureEventArgs.Create(dataAssetName, exception.ToString(), userData);
                            m_ReadDataFailureEventHandler(this, loadDataFailureEventArgs);
                            ReferencePool.Release(loadDataFailureEventArgs);
                            return;
                        }

                        throw;
                    }

                    break;

                default:
                    throw new GameFrameworkException(Utility.Text.Format("Data asset '{0}' is '{1}'.", dataAssetName, result));
            }
        }

        /// <summary>
        /// 解析内容。
        /// </summary>
        /// <param name="dataString">要解析的内容字符串。</param>
        /// <returns>是否解析内容成功。</returns>
        public bool ParseData(string dataString)
        {
            return ParseData(dataString, null);
        }

        /// <summary>
        /// 解析内容。
        /// </summary>
        /// <param name="dataString">要解析的内容字符串。</param>
        /// <param name="userData">用户自定义数据。</param>

View on GitHub (pinned to d0c010b051)