{"record":{"id":"1915a8e45e59feb2","repo":"Unity-Technologies/UnityCsReference","slug":"unknown-platform-0","errorCode":null,"errorMessage":"Unknown platform '{0}'","messagePattern":"Unknown platform '(.+?)'","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/Inspector/AssemblyDefinitionImporterInspector.cs","lineNumber":1007,"sourceCode":"                else\n                    data.includePlatforms = dataPlatforms.ToArray();\n            }\n\n            var json = CustomScriptAssemblyData.ToJson(data);\n            File.WriteAllText(state.path, json);\n\n            AssetDatabase.ImportAsset(state.path);\n        }\n\n        static int GetPlatformIndex(AssemblyDefinitionPlatform[] platforms, string name)\n        {\n            for (int i = 0; i < platforms.Length; ++i)\n            {\n                if (string.Equals(platforms[i].Name, name, System.StringComparison.InvariantCultureIgnoreCase))\n                    return i;\n            }\n\n            throw new System.ArgumentException(string.Format(\"Unknown platform '{0}'\", name), name);\n        }\n\n        void DrawReferenceListElement(Rect rect, int index, bool selected, bool focused)\n        {\n            var assemblyDefinitionFile = m_ReferencesList.serializedProperty.GetArrayElementAtIndex(index);\n            var nameProp = assemblyDefinitionFile.FindPropertyRelative(\"name\");\n            var assetProp = assemblyDefinitionFile.FindPropertyRelative(\"asset\");\n\n            rect.height -= EditorGUIUtility.standardVerticalSpacing;\n            var label = string.IsNullOrEmpty(nameProp.stringValue) ? L10n.Tr(\"(Missing Reference)\") : nameProp.stringValue;\n            using (var change = new EditorGUI.ChangeCheckScope())\n            {\n                EditorGUI.showMixedValue = assetProp.hasMultipleDifferentValues;\n                EditorGUI.BeginDisabled(!string.IsNullOrEmpty(nameProp.stringValue) && assetProp.objectReferenceValue == null);\n                var obj = EditorGUI.ObjectField(rect, EditorGUI.showMixedValue ? GUIContent.Temp(\"(Multiple Values)\") : GUIContent.Temp(label), assetProp.objectReferenceValue, typeof(AssemblyDefinitionAsset), false);\n                EditorGUI.showMixedValue = false;\n                EditorGUI.EndDisabled();\n","sourceCodeStart":989,"sourceCodeEnd":1025,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/Inspector/AssemblyDefinitionImporterInspector.cs#L989-L1025","documentation":"GetPlatformIndex linearly searches an AssemblyDefinitionPlatform[] for a case-insensitive name match and throws ArgumentException if none is found. It is used to locate a platform when resolving assembly definition references, so an unknown name is treated as an invalid input rather than returning -1.","triggerScenarios":"Passing a platform name string that is not present in the AssemblyDefinitionPlatform[] array provided to the inspector — e.g. a platform not installed/registered in this editor, a typo, or a platform that was removed.","commonSituations":"An asmdef referencing a platform that is not installed in the current Unity (e.g. a paid/console module absent from this install). A platform name that changed across versions. Manually editing the asmdef JSON with an invalid platform name. Loading a project from a teammate who had extra platform modules installed.","solutions":["Install the platform module the asmdef references via the Unity Hub/Package Manager.","Correct the platform name in the asmdef JSON (AssemblyDefinitionImporterInspector) to one present in the registered platforms list.","Remove the reference to platforms not available in your editor install.","Confirm the exact Name property expected (the match is case-insensitive against AssemblyDefinitionPlatform.Name)."],"exampleFix":"// before: asmdef references \"Switch\" which is not installed -> ArgumentException\n\n// after: install Nintendo Switch module, or edit asmdef to drop the platform","handlingStrategy":"validation","validationCode":"// ensure the platform is registered before lookup\nbool known = Array.Exists(platforms, p => string.Equals(p.Name, name, StringComparison.InvariantCultureIgnoreCase));\nif (!known) throw new InvalidOperationException($\"Platform '{name}' is not installed in this editor.\");","typeGuard":"static int SafePlatformIndex(AssemblyDefinitionPlatform[] platforms, string name)\n{\n    for (int i = 0; i < platforms.Length; i++)\n        if (string.Equals(platforms[i].Name, name, StringComparison.InvariantCultureIgnoreCase)) return i;\n    return -1;\n}","tryCatchPattern":null,"preventionTips":["Install platform modules referenced by asmdefs via Unity Hub before opening the project.","Validate asmdef platform names against the installed platforms list.","Edit asmdef JSON to remove platforms absent from your install."],"tags":["assembly-definition","platform","asmdef","argument","module-install"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}