Unity-Technologies/UnityCsReference · error · Exception

Unexpected mixed value for '{assetPath}', platform: {platfor

Error message

Unexpected mixed value for '{assetPath}', platform: {platformName}

What it means

Thrown inside DesktopSingleCPUProperty.IsTargetEnabled when PluginImporterInspector.GetPlatformCompatibility returns Compatibility.Mixed. 'Mixed' means different selected plugins disagree on compatibility for that platform, which the single-CPU property logic cannot resolve into a single enabled/disabled answer, so it treats it as an unexpected (buggy) state rather than a silent default.

Source

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

        }

        internal class DesktopSingleCPUProperty : Property
        {
            public DesktopSingleCPUProperty(BuildTarget buildTarget, DesktopPluginCPUArchitecture architecture)
                : base(EditorGUIUtility.TrTextContent(GetArchitectureNameInGUI(buildTarget, architecture)), cpuKey, architecture, BuildPipeline.GetBuildTargetName(buildTarget))
            {
            }

            public DesktopSingleCPUProperty(GUIContent name, BuildTarget buildTarget)
                : base(name, cpuKey, DesktopPluginCPUArchitecture.AnyCPU, BuildPipeline.GetBuildTargetName(buildTarget))
            {
            }

            internal bool IsTargetEnabled(PluginImporterInspector inspector)
            {
                PluginImporterInspector.Compatibility compatibililty = inspector.GetPlatformCompatibility(platformName);
                if (compatibililty == PluginImporterInspector.Compatibility.Mixed)
                    throw new Exception("Unexpected mixed value for '" + inspector.importer.assetPath + "', platform: " + platformName);
                if (compatibililty != PluginImporterInspector.Compatibility.Compatible)
                    return false;

                var pluginCPU = value as DesktopPluginCPUArchitecture ? ?? DesktopPluginCPUArchitecture.None;
                return pluginCPU == (DesktopPluginCPUArchitecture)defaultValue || pluginCPU == DesktopPluginCPUArchitecture.AnyCPU;
            }

            internal override void OnGUI(PluginImporterInspector inspector)
            {
                EditorGUILayout.BeginHorizontal();
                GUILayout.Space(10);
                EditorGUI.BeginChangeCheck();

                // This toggle controls two things:
                // * Is platform enabled/disabled?
                // * Platform CPU value
                bool isTargetEnabled = EditorGUILayout.Toggle(name, IsTargetEnabled(inspector));
                if (EditorGUI.EndChangeCheck())

View on GitHub (pinned to 225b0fbdb5)

Solutions

  1. Select a single plugin asset instead of a multi-selection when adjusting per-platform CPU compatibility.
  2. Re-import the affected plugins (Reimport) to refresh their serialized compatibility state so it is no longer Mixed.
  3. Verify all selected plugins share the same platform compatibility before editing; align them via the inspector for one asset at a time.
  4. If it reproduces on a clean selection, file a Unity bug — the comment framing implies Mixed should have been normalized upstream.

Example fix

// before: multi-select plugins with differing compatibility -> inspector throws

// after: select one plugin, or align compatibility first
foreach (var p in selectedPlugins) p.SetCompatibleWithPlatform(platformName, desired);
Defensive patterns

Strategy: validation

Validate before calling

// avoid driving IsTargetEnabled on a mixed selection
var compat = inspector.GetPlatformCompatibility(platformName);
if (compat == PluginImporterInspector.Compatibility.Mixed)
    return false; // or prompt user to single-select
// safe to call IsTargetEnabled-equivalent logic now

Try / catch

try { enabled = cpuProp.IsTargetEnabled(inspector); }
catch (Exception) { enabled = false; /* mixed/invalid compatibility, skip */ }

Prevention

When it happens

Trigger: Opening the PluginImporterInspector while multiple plugin assets are selected (multi-object editing) and those plugins report different per-platform compatibility for the same desktop platform string, yielding Compatibility.Mixed.

Common situations: Multi-selecting two or more native plugin files whose per-platform enable flags differ. A serialization or import-state inconsistency where one plugin is marked Compatible and another NotCompatible for the same BuildTarget. Editor code paths that build a mixed selection and force the inspector to evaluate CPU enablement.

Related errors


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