{"record":{"id":"86ba5fd48a48657b","repo":"Unity-Technologies/UnityCsReference","slug":"failed-to-resolve-standalone-platform-platform-st","errorCode":null,"errorMessage":"Failed to resolve standalone platform, platform string '{0}', resolved target '{1}'","messagePattern":"Failed to resolve standalone platform, platform string '(.+?)', resolved target '(.+?)'","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"Editor/Mono/ImportSettings/DesktopPluginImporterExtension.cs","lineNumber":298,"sourceCode":"\n                foreach (var importer in inspector.importers)\n                {\n                    importer.SetPlatformData(target.platformName, cpuKey, target.value.ToString());\n                }\n            }\n        }\n\n        public override string CalculateFinalPluginPath(string platformName, PluginImporter imp)\n        {\n            BuildTarget target = BuildPipeline.GetBuildTargetByName(platformName);\n            bool pluginForWindows = target == BuildTarget.StandaloneWindows || target == BuildTarget.StandaloneWindows64;\n#pragma warning disable 612, 618\n            bool pluginForOSX = target == BuildTarget.StandaloneOSXIntel || target == BuildTarget.StandaloneOSXIntel64 || target == BuildTarget.StandaloneOSX;\n            bool pluginForLinux = target == BuildTarget.StandaloneLinux || target == BuildTarget.StandaloneLinux64 || target == BuildTarget.StandaloneLinuxUniversal || target == BuildTarget.LinuxHeadlessSimulation;\n#pragma warning restore 612, 618\n\n            if (!pluginForLinux && !pluginForOSX && !pluginForWindows)\n                throw new Exception(string.Format(\"Failed to resolve standalone platform, platform string '{0}', resolved target '{1}'\",\n                    platformName, target.ToString()));\n\n            if (pluginForWindows && !IsUsableOnWindows(imp))\n                return string.Empty;\n            if (pluginForOSX && !IsUsableOnOSX(imp))\n                return string.Empty;\n            if (pluginForLinux && !IsUsableOnLinux(imp))\n                return string.Empty;\n\n            string cpu = imp.GetPlatformData(platformName, cpuKey);\n\n            if (string.Compare(cpu, \"None\", true) == 0)\n                return string.Empty;\n\n            if (pluginForWindows)\n            {\n                if (string.Compare(cpu, nameof(DesktopPluginCPUArchitecture.ARM64), true) == 0)\n                {","sourceCodeStart":280,"sourceCodeEnd":316,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/ImportSettings/DesktopPluginImporterExtension.cs#L280-L316","documentation":"CalculateFinalPluginPath resolves the BuildTarget from a platform name string and checks it against the known standalone families (Windows, OSX, Linux). If none match, it throws because the DesktopPluginImporterExtension only knows how to place plugins for desktop standalone targets and cannot compute a path for anything else.","triggerScenarios":"Calling CalculateFinalPluginPath with a platformName that resolves to a BuildTarget which is not StandaloneWindows/Windows64, StandaloneOSX (Intel/Intel64/universal), or StandaloneLinux/Linux64/LinuxUniversal/LinuxHeadlessSimulation. Also when BuildPipeline.GetBuildTargetByName returns an unexpected/None target for the string.","commonSituations":"A platform string from a non-desktop target (mobile, console, web) being routed through the desktop extension. A stale or renamed platform string after a Unity version upgrade (deprecated targets). Custom build pipeline code passing a display name instead of the internal platform name.","solutions":["Ensure the platformName passed is one of the recognized standalone platform names before calling CalculateFinalPluginPath.","Verify BuildPipeline.GetBuildTargetByName(platformName) returns a Standalone target; if it returns None or a non-standalone target, route to the correct extension instead.","Update platform strings after a Unity upgrade if target names were deprecated (see the #pragma 612/618 suppressed legacy targets).","Add a guard that skips desktop path calculation for non-standalone platforms."],"exampleFix":"// before\nstring path = ext.CalculateFinalPluginPath(platformName, imp); // throws for non-standalone\n\n// after\nvar target = BuildPipeline.GetBuildTargetByName(platformName);\nif (IsStandaloneTarget(target))\n    path = ext.CalculateFinalPluginPath(platformName, imp);\nelse\n    path = nonDesktopExt.CalculateFinalPluginPath(platformName, imp);","handlingStrategy":"validation","validationCode":"var target = BuildPipeline.GetBuildTargetByName(platformName);\nbool standalone = target == BuildTarget.StandaloneWindows || target == BuildTarget.StandaloneWindows64\n    || target == BuildTarget.StandaloneOSX || target == BuildTarget.StandaloneLinux64;\nif (!standalone) return string.Empty; // route to the correct extension instead","typeGuard":"static bool IsStandaloneTarget(BuildTarget t) =>\n    t == BuildTarget.StandaloneWindows || t == BuildTarget.StandaloneWindows64 ||\n    t == BuildTarget.StandaloneOSX || t == BuildTarget.StandaloneLinux64 ||\n    t == BuildTarget.StandaloneLinuxUniversal;","tryCatchPattern":"try { return ext.CalculateFinalPluginPath(platformName, imp); }\ncatch (Exception) { return string.Empty; /* non-standalone platform, no desktop path */ }","preventionTips":["Route plugin path calculation to the extension matching the target family (desktop/mobile/etc.).","Validate the resolved BuildTarget is standalone before calling the desktop extension.","After Unity upgrades, re-check deprecated target names (the source suppresses 612/618)."],"tags":["plugin-importer","build-target","standalone","desktop","platform"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}