Unity-Technologies/UnityCsReference · error · NotImplementedException

Missing name for {0}

Error message

Missing name for {0}

What it means

Thrown by GetGUIContentsForValues when an enum value passed in has no pre-populated GUIContent mapping in the cache dictionary. Acts as a completeness assertion: every enum value must have a display name registered.

Source

Thrown at Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsEditor.cs:4721

        }

        [NoAutoStaticsCleanup] // lazy-built GUIContent cache; rebuilt on next GUI call if null
        private static Dictionary<ApiCompatibilityLevel, GUIContent> m_NiceApiCompatibilityLevelNames;
        [NoAutoStaticsCleanup] // lazy-built GUIContent cache; rebuilt on next GUI call if null
        private static Dictionary<EditorAssembliesCompatibilityLevel, GUIContent> m_NiceEditorAssembliesCompatibilityLevelNames;
        [NoAutoStaticsCleanup] // lazy-built GUIContent cache; rebuilt on next GUI call if null
        private static Dictionary<ManagedStrippingLevel, GUIContent> m_NiceManagedStrippingLevelNames;

        private static GUIContent[] GetGUIContentsForValues<T>(Dictionary<T, GUIContent> contents, T[] values)
        {
            var names = new GUIContent[values.Length];

            for (int i = 0; i < values.Length; i++)
            {
                if (contents.ContainsKey(values[i]))
                    names[i] = contents[values[i]];
                else
                    throw new NotImplementedException(string.Format("Missing name for {0}", values[i]));
            }
            return names;
        }

        static GUIContent[] GetNiceScriptingBackendNames(ScriptingImplementation[] scriptingBackends)
        {
            return Array.ConvertAll(scriptingBackends, s => GetNiceScriptingBackendName(s));
        }

        static GUIContent GetNiceScriptingBackendName(ScriptingImplementation scriptingBackend)
        {
            switch (scriptingBackend)
            {
                case ScriptingImplementation.Mono2x:
                    return SettingsContent.scriptingMono2x;
                case ScriptingImplementation.IL2CPP:
                    return SettingsContent.scriptingIL2CPP;
                case ScriptingImplementation.CoreCLR:

View on GitHub (pinned to 225b0fbdb5)

Solutions

  1. Register a GUIContent for every enum value in the dictionary before calling GetGUIContentsForValues.
  2. If hitting this on upgrade, report as a Unity bug: the cache must cover all enum values.
  3. For custom tooling, populate the dictionary with all Enum.GetValues entries with fallback names.

Example fix

// before
var contents = GetGUIContentsForValues(cache, values); // throws on missing entry

// after
foreach (var v in values)
    if (!cache.ContainsKey(v))
        cache[v] = new GUIContent(v.ToString());
var contents = GetGUIContentsForValues(cache, values);
Defensive patterns

Strategy: validation

Validate before calling

T[] values;
bool ok = values.All(v => contents.ContainsKey(v));

Prevention

When it happens

Trigger: A ManagedStrippingLevel (or other T) value is passed to GetGUIContentsForValues but was never added to the m_NiceManagedStrippingLevelNames (or sibling) dictionary. Adding a new enum value without registering its display name.

Common situations: Unity adds a new ManagedStrippingLevel / scripting-related enum value in an upgrade but the GUIContent cache population code lags behind. Custom build profiles exposing enum values not in the standard set.

Related errors


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