Unity-Technologies/UnityCsReference · error · NotSupportedException

Unknown DesktopPluginCPUArchitecture value: {architecture}

Error message

Unknown DesktopPluginCPUArchitecture value: {architecture}

What it means

GetCPUString switches over DesktopPluginCPUArchitecture and the default arm throws NotSupportedException for an unhandled enum value. This is a defensive exhaustive-switch guard: every defined architecture (None, x86, x86_64, ARM64, AnyCPU) has a case, so reaching default implies an enum value the editor build does not know about.

Source

Thrown at Editor/Mono/ImportSettings/DesktopPluginImporterExtension.cs:374

            switch (architecture)
            {
                case DesktopPluginCPUArchitecture.None :
                    return "None";

                case DesktopPluginCPUArchitecture.x86 :
                    return buildTarget == BuildTarget.StandaloneOSX ? "Intel 32-bit" : "x86";

                case DesktopPluginCPUArchitecture.x86_64:
                    return buildTarget == BuildTarget.StandaloneOSX ? "Intel 64-bit" : "x64";

                case DesktopPluginCPUArchitecture.ARM64:
                    return buildTarget == BuildTarget.StandaloneOSX ? "Apple silicon" : "ARM64";

                case DesktopPluginCPUArchitecture.AnyCPU:
                    return "Any CPU";

                default:
                    throw new NotSupportedException("Unknown DesktopPluginCPUArchitecture value: " + architecture);
            }
        }
    }
}

View on GitHub (pinned to 225b0fbdb5)

Solutions

  1. Re-open the project in the Unity version that wrote the plugin asset, or upgrade the editor to the version that introduced the new enum member.
  2. Reset the plugin's CPU architecture in the inspector to a known value (AnyCPU/x86_64) and re-save.
  3. Reimport the plugin to re-derive a valid architecture from its binary metadata.
  4. If authoring a fork, add a case for the new enum value in GetCPUString.

Example fix

// before: serialized enum value unknown to this editor -> default throws

// after: reset to a known architecture via inspector or
imp.SetPlatformData(platformName, cpuKey, nameof(DesktopPluginCPUArchitecture.x86_64));
Defensive patterns

Strategy: type-guard

Validate before calling

if (!Enum.IsDefined(typeof(DesktopPluginCPUArchitecture), architecture))
    architecture = DesktopPluginCPUArchitecture.AnyCPU; // or reject

Type guard

static bool IsKnown(DesktopPluginCPUArchitecture a) =>
    a == DesktopPluginCPUArchitecture.None || a == DesktopPluginCPUArchitecture.x86 ||
    a == DesktopPluginCPUArchitecture.x86_64 || a == DesktopPluginCPUArchitecture.ARM64 ||
    a == DesktopPluginCPUArchitecture.AnyCPU;

Prevention

When it happens

Trigger: A DesktopPluginCPUArchitecture value not covered by any case reaches the switch — typically a value from a newer/different Unity version or a deserialized/corrupted enum value that is numerically outside the known set.

Common situations: Loading a project or plugin asset whose serialized CPU architecture enum was written by a newer Unity version that added a member (e.g. a new ARM variant). Manually editing serialized plugin data. Version skew between the editor and an asset imported elsewhere.

Related errors


AI-assisted analysis of Unity-Technologies/UnityCsReference@225b0fbdb5 (2026-08-13). Data as JSON: /api/errors/9124873ebfbd6498. Report an issue: GitHub.