{"record":{"id":"b9b77a16b49966fa","repo":"Unity-Technologies/UnityCsReference","slug":"platform-name-0-not-supported-supported-platf","errorCode":null,"errorMessage":"Platform name '{0}' not supported.\nSupported platform names:\n{1}\n","messagePattern":"Platform name '(.+?)' not supported\\.\nSupported platform names:\n(.+?)\n","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/Scripting/ScriptCompilation/CustomScriptAssembly.cs","lineNumber":696,"sourceCode":"            foreach(var platformName in RenamedPlatforms)\n                if (string.Equals(platformName, name, System.StringComparison.OrdinalIgnoreCase))\n                    return true;\n\n            return false;\n        }\n\n        public static CustomScriptAssemblyPlatform GetPlatformFromName(string name)\n        {\n            foreach (var platform in Platforms)\n                if (string.Equals(platform.Name, name, System.StringComparison.OrdinalIgnoreCase))\n                    return platform;\n\n            var platformNames = Platforms.ConvertAll(p => string.Format(\"\\\"{0}\\\"\", p.Name));\n            platformNames.Sort();\n\n            var platformsString = string.Join(\",\\n\", platformNames);\n\n            throw new System.ArgumentException(string.Format(\"Platform name '{0}' not supported.\\nSupported platform names:\\n{1}\\n\", name, platformsString));\n        }\n\n        public static CustomScriptAssemblyPlatform GetPlatformFromBuildTarget(BuildTarget buildTarget)\n        {\n            foreach (var platform in Platforms)\n                if (platform.BuildTarget == buildTarget)\n                    return platform;\n\n            throw new System.ArgumentException(string.Format(\"No CustomScriptAssemblyPlatform setup for BuildTarget '{0}'\", buildTarget));\n        }\n\n        public override bool Equals(object obj)\n        {\n            if (ReferenceEquals(null, obj)) return false;\n            if (ReferenceEquals(this, obj)) return true;\n            if (obj.GetType() != this.GetType()) return false;\n            return Equals((CustomScriptAssembly) obj);\n        }","sourceCodeStart":678,"sourceCodeEnd":714,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/Scripting/ScriptCompilation/CustomScriptAssembly.cs#L678-L714","documentation":"Thrown by CustomScriptAssembly.GetPlatformFromName (CustomScriptAssembly.cs:696, ArgumentException) when none of the entries in the static Platforms list match the requested platform name (case-insensitive). The message lists every supported platform name so the developer can pick a valid one. This is reached when resolving names from an asmdef's include/excludePlatforms arrays that were not already rejected as deprecated or renamed.","triggerScenarios":"An asmdef lists a platform name that is not recognized by the installed editor build, e.g. \"iPhone\" (legacy) after Unity renamed it, or \"WebGL\" spelled \"Webgl\", or a platform whose module is not installed.","commonSituations":"Upgrading a project across Unity versions where a platform was renamed or removed. Sharing an asmdef authored on an editor build that includes a platform the current install lacks. Old tutorials using obsolete platform identifiers.","solutions":["Read the supported platform names printed in the error message and replace the invalid entry with the exact string shown (matching is case-insensitive but the spelling must match).","If the platform was renamed, check RenamedPlatforms / DeprecatedPlatforms handling and use the current canonical name (e.g. \"iPhone\" -> \"iOS\").","If the platform module is genuinely absent from your editor install, install the platform module or remove the entry."],"exampleFix":"// before (.asmdef)\n\"includePlatforms\": [\"iPhone\"]\n// after\n\"includePlatforms\": [\"iOS\"]","handlingStrategy":"validation","validationCode":"// Validate platform names against the editor's supported set before writing an asmdef\nvar supported = new HashSet<string>(\n    UnityEditor.Compilation.CompilationPipeline.GetAssemblyDefinitionPlatforms()\n        .Select(p => p.Name), StringComparer.OrdinalIgnoreCase);\n\nforeach (var p in (data.includePlatforms ?? Array.Empty<string>()).Concat(data.excludePlatforms ?? Array.Empty<string>()))\n    if (!supported.Contains(p))\n        throw new InvalidOperationException($\"Unsupported platform name '{p}'. Valid: {string.Join(\", \", supported.OrderBy(x => x))}\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pick platform names from the Inspector dropdown rather than hand-typing them.","After a Unity upgrade, scan asmdefs for platform names that may have been renamed/removed.","Treat platform-name lists as version-specific; do not assume a name is stable across major versions."],"tags":["unity","asmdef","script-compilation","platforms","config"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}