Unity-Technologies/UnityCsReference · warning · NotImplementedException
The DialogOptOut type named {0} has not been implemented.
Error message
The DialogOptOut type named {0} has not been implemented. What it means
Thrown by the DialogOptOutService.GetDialogOptOutMessage switch when the DialogOptOutDecisionType value is neither ForThisUser nor ForThisSession. This is a defensive default arm: as Unity extends the enum, every unhandled new case surfaces here so the localizable message is never silently wrong. It is a NotImplementedException, signaling incomplete implementation rather than bad input.
Source
Thrown at Editor/Mono/EditorUtility.cs:66
}
public partial class EditorUtility
{
static class Content
{
public static readonly string Cancel = L10n.Tr("Cancel");
static readonly string k_DialogOptOutForThisMachine = L10n.Tr("Do not show me this message again on this machine.");
static readonly string k_DialogOptOutForThisSession = L10n.Tr("Do not show me this message again for this session.");
public static string GetDialogOptOutMessage(DialogOptOutDecisionType dialogOptOutType)
{
switch (dialogOptOutType)
{
case DialogOptOutDecisionType.ForThisUser:
return k_DialogOptOutForThisMachine;
case DialogOptOutDecisionType.ForThisSession:
return k_DialogOptOutForThisSession;
default:
throw new NotImplementedException(string.Format("The DialogOptOut type named {0} has not been implemented.", dialogOptOutType));
}
}
}
[NoAutoStaticsCleanup] // StringBuilder reuse pool, no user-type references; safe to persist across reload
private static readonly Stack<StringBuilder> _SbPool = new Stack<StringBuilder>();
public delegate void SelectMenuItemFunction(object userData, string[] options, int selected);
[AutoStaticsCleanupOnCodeReload]
internal static event Action onResetMouseDown;
public static bool LoadWindowLayout(string path)
{
return WindowLayout.TryLoadWindowLayout(path, false);
}
public static void CompressTexture(Texture2D texture, TextureFormat format, TextureCompressionQuality quality)View on GitHub (pinned to 225b0fbdb5)
Solutions
- If extending DialogOptOutDecisionType, add the new case to all three switches (lines 66, 187, 202) and provide the message and storage behavior.
- As a caller, restrict input to the two known enum values; do not cast arbitrary ints.
- Treat a NotImplementedException here as a Unity bug to report, not a runtime condition to handle.
Example fix
// before (Unity internal): enum gains ForThisProject, switch unhandled -> throws
// after: add the case
switch (dialogOptOutType) {
case DialogOptOutDecisionType.ForThisProject:
return k_DialogOptOutForThisProject;
...
} Defensive patterns
Strategy: try-catch
Validate before calling
if (dialogOptOutType != DialogOptOutDecisionType.ForThisUser && dialogOptOutType != DialogOptOutDecisionType.ForThisSession) { Debug.LogError("Unsupported DialogOptOutDecisionType"); return string.Empty; } Type guard
static bool IsSupportedDialogOptOut(DialogOptOutDecisionType t) => t == DialogOptOutDecisionType.ForThisUser || t == DialogOptOutDecisionType.ForThisSession;
Try / catch
try { return DialogOptOutService.GetDialogOptOutMessage(t); } catch (NotImplementedException) { return string.Empty; } Prevention
- Never cast arbitrary ints to DialogOptOutDecisionType.
- If extending the enum, update all three switches together.
- Treat a NotImplementedException here as a Unity bug, not a user error.
When it happens
Trigger: A future DialogOptOutDecisionType value is added to the enum but this switch is not updated. Cannot be triggered by user code because the enum is closed and both current values are handled.
Common situations: Internal Unity development when extending the opt-out enum; reflection that fabricates an out-of-range enum value (technically possible but unsupported).
Related errors
- The DialogComplexResult named {0} has not been implemented.
- Parameter selected must be of type System.Enum
- Parameter enumValue must be of type System.Enum
- Unsupported enum base type for {0}
- Specified enumType must be System.Enum
AI-assisted analysis of Unity-Technologies/UnityCsReference@225b0fbdb5 (2026-08-13).
Data as JSON: /api/errors/14d95180d1316398.
Report an issue: GitHub.