{"record":{"id":"14d95180d1316398","repo":"Unity-Technologies/UnityCsReference","slug":"the-dialogoptout-type-named-0-has-not-been-imple","errorCode":null,"errorMessage":"The DialogOptOut type named {0} has not been implemented.","messagePattern":"The DialogOptOut type named (.+?) has not been implemented\\.","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"warning","filePath":"Editor/Mono/EditorUtility.cs","lineNumber":66,"sourceCode":"    }\n\n    public partial class EditorUtility\n    {\n        static class Content\n        {\n            public static readonly string Cancel = L10n.Tr(\"Cancel\");\n            static readonly string k_DialogOptOutForThisMachine = L10n.Tr(\"Do not show me this message again on this machine.\");\n            static readonly string k_DialogOptOutForThisSession = L10n.Tr(\"Do not show me this message again for this session.\");\n            public static string GetDialogOptOutMessage(DialogOptOutDecisionType dialogOptOutType)\n            {\n                switch (dialogOptOutType)\n                {\n                    case DialogOptOutDecisionType.ForThisUser:\n                        return k_DialogOptOutForThisMachine;\n                    case DialogOptOutDecisionType.ForThisSession:\n                        return k_DialogOptOutForThisSession;\n                    default:\n                        throw new NotImplementedException(string.Format(\"The DialogOptOut type named {0} has not been implemented.\", dialogOptOutType));\n                }\n            }\n        }\n\n        [NoAutoStaticsCleanup] // StringBuilder reuse pool, no user-type references; safe to persist across reload\n        private static readonly Stack<StringBuilder> _SbPool = new Stack<StringBuilder>();\n\n        public delegate void SelectMenuItemFunction(object userData, string[] options, int selected);\n\n        [AutoStaticsCleanupOnCodeReload]\n        internal static event Action onResetMouseDown;\n\n        public static bool LoadWindowLayout(string path)\n        {\n            return WindowLayout.TryLoadWindowLayout(path, false);\n        }\n\n        public static void CompressTexture(Texture2D texture, TextureFormat format, TextureCompressionQuality quality)","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/EditorUtility.cs#L48-L84","documentation":"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.","triggerScenarios":"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.","commonSituations":"Internal Unity development when extending the opt-out enum; reflection that fabricates an out-of-range enum value (technically possible but unsupported).","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."],"exampleFix":"// before (Unity internal): enum gains ForThisProject, switch unhandled -> throws\n// after: add the case\nswitch (dialogOptOutType) {\n  case DialogOptOutDecisionType.ForThisProject:\n    return k_DialogOptOutForThisProject;\n  ...\n}","handlingStrategy":"try-catch","validationCode":"if (dialogOptOutType != DialogOptOutDecisionType.ForThisUser && dialogOptOutType != DialogOptOutDecisionType.ForThisSession) { Debug.LogError(\"Unsupported DialogOptOutDecisionType\"); return string.Empty; }","typeGuard":"static bool IsSupportedDialogOptOut(DialogOptOutDecisionType t) => t == DialogOptOutDecisionType.ForThisUser || t == DialogOptOutDecisionType.ForThisSession;","tryCatchPattern":"try { return DialogOptOutService.GetDialogOptOutMessage(t); } catch (NotImplementedException) { return string.Empty; }","preventionTips":["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."],"tags":["csharp","unity-editor","dialog","enum","not-implemented","future-proofing"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}