egametang/ET · error

unsupported config type: {configProcessAttribute.ConfigType}

Error message

unsupported config type: {configProcessAttribute.ConfigType} {configType.FullName}

What it means

Thrown by LoadOneConfig when a config type's ConfigProcessAttribute.ConfigType is not ConfigType.Code. LoadOneConfig only handles code-mode configs (it expects to build the category from C# code via a factory); other config kinds (e.g. binary/proto asset-loaded configs) are loaded through a different path and must not reach this method.

Source

Thrown at Packages/cn.etetet.loader/Scripts/Loader/Share/ConfigLoaderHelper.cs:128

            foreach (Type factoryType in factoryTypes)
            {
                if (Activator.CreateInstance(factoryType) is not IConfigFactory factory)
                {
                    throw new Exception($"create config factory failed: {factoryType.FullName}");
                }

                factories.Add(GetConfigGroup(factoryType), factory);
            }

            return factories;
        }

        public static ASingleton LoadOneConfig(Type configType, ConfigFactoryGroupCollection configFactories, Dictionary<Type, IConfig> loadedConfigs)
        {
            ConfigProcessAttribute configProcessAttribute = configType.GetCustomAttributes(typeof(ConfigProcessAttribute), false)[0] as ConfigProcessAttribute;
            if (configProcessAttribute.ConfigType != ConfigType.Code)
            {
                throw new Exception($"unsupported config type: {configProcessAttribute.ConfigType} {configType.FullName}");
            }

            IConfigFactory factory = GetConfigFactory(configType, configFactories);
            object category = factory.Create();
            if (category == null)
            {
                throw new Exception($"config create failed: {configType.FullName}");
            }

            if (category.GetType() != configType)
            {
                throw new Exception($"config type mismatch: expect={configType.FullName} actual={category.GetType().FullName}");
            }

            if (category is not ASingleton singleton)
            {
                throw new Exception($"config singleton invalid: {configType.FullName}");
            }

View on GitHub (pinned to 5cab01f7a8)

Solutions

  1. Filter config types by ConfigProcessAttribute.ConfigType == ConfigType.Code before calling LoadOneConfig (the caller should route non-Code types elsewhere).
  2. Correct the attribute on the offending config type if it should be Code.
  3. Ensure the loader's dispatch matches the set of ConfigType values produced by codegen.

Example fix

// before — LoadOneConfig called for every config type
foreach (Type t in configTypes) LoadOneConfig(t, factories, loaded);

// after — route by ConfigType
foreach (Type t in configTypes)
{
    var attr = (ConfigProcessAttribute)t.GetCustomAttributes(typeof(ConfigProcessAttribute), false)[0];
    if (attr.ConfigType != ConfigType.Code) continue; // handled elsewhere
    LoadOneConfig(t, factories, loaded);
}
Defensive patterns

Strategy: validation

Validate before calling

var attr = (ConfigProcessAttribute)t.GetCustomAttributes(typeof(ConfigProcessAttribute), false)[0];
if (attr.ConfigType != ConfigType.Code) { /* route to non-code loader */ return; }
ConfigLoaderHelper.LoadOneConfig(t, factories, loaded);

Type guard

static bool IsCodeConfig(Type t)
{
    var attr = (ConfigProcessAttribute)t.GetCustomAttributes(typeof(ConfigProcessAttribute), false).FirstOrDefault();
    return attr != null && attr.ConfigType == ConfigType.Code;
}

Prevention

When it happens

Trigger: GetConfigTypes() returns all types marked with ConfigProcessAttribute; LoadOneConfig is invoked for each, but one was authored/marked as a non-Code config type (e.g. ConfigType.Asset or similar) and was incorrectly routed into the code-loading path.

Common situations: A config category's attribute was changed from Code to another type but the loader dispatch still calls LoadOneConfig for it; a new config kind was added without updating the loader's routing logic; misconfigured ConfigProcessAttribute during codegen.

Related errors


AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13). Data as JSON: /api/errors/55d7fec2add30913. Report an issue: GitHub.