{"record":{"id":"8b6b557b88ba471c","repo":"Unity-Technologies/UnityCsReference","slug":"the-propertypath-argument-can-t-be-null-or-empty","errorCode":null,"errorMessage":"The propertyPath argument can't be null or empty.","messagePattern":"The propertyPath argument can't be null or empty\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/Inspector/GraphicsSettingsInspectors/GraphicsSettingsInspectorUtility.cs","lineNumber":350,"sourceCode":"\n        #endregion\n\n        #region OpenAndScrollTo\n\n        const string highlightableClass = \"graphics-settings__highlightable\";\n        const string highlightableColorClass = \"graphics-settings__highlightable--background-color\";\n\n        [NoAutoStaticsCleanup] // transient event-depth counter reset to 0 at the start of each OpenAndScrollTo; a persisted value is harmless\n        static int s_EventCounter;\n        [AutoStaticsCleanupOnCodeReload]\n        static VisualElement s_SearchedElement;\n        [AutoStaticsCleanupOnCodeReload]\n        static readonly List<Foldout> k_Foldouts = new();\n\n        public static void OpenAndScrollTo(string propertyPath)\n        {\n            if (string.IsNullOrEmpty(propertyPath))\n                throw new ArgumentException(nameof(propertyPath), $\"The {nameof(propertyPath)} argument can't be null or empty.\");\n\n            OpenAndScrollTo<PropertyField, PropertyField>(\n                root => TryFindPropertyAndTabByBindingPath(propertyPath, root, out var tabbedView, out var tabButton, out var propertyField)\n                    ? (true, tabbedView, tabButton, propertyField)\n                    : (false, null, null, null),\n                () => $\"Couldn't find a property with bindingPath {propertyPath} in the settings container.\",\n                (scrollView, _, propertyField, _) => OpenFoldoutsThenScroll(propertyField, scrollView));\n        }\n\n        public static void OpenAndScrollToElement(string elementName)\n        {\n            if (string.IsNullOrEmpty(elementName))\n                throw new ArgumentException(nameof(elementName), $\"The {nameof(elementName)} argument can't be null or empty.\");\n\n            OpenAndScrollTo<VisualElement, VisualElement>(\n                root => TryFindElementAndTabByName(elementName, root, out var tabbedView, out var tabButton, out var element)\n                    ? (true, tabbedView, tabButton, element)\n                    : (false, null, null, null),","sourceCodeStart":332,"sourceCodeEnd":368,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/Inspector/GraphicsSettingsInspectors/GraphicsSettingsInspectorUtility.cs#L332-L368","documentation":"OpenAndScrollTo requires a propertyPath to locate a field in the Graphics Settings UI; an empty or null path is meaningless for the lookup, so it throws ArgumentException up front.","triggerScenarios":"Calling GraphicsSettingsInspectorUtility.OpenAndScrollTo(null) or OpenAndScrollTo(\"\").","commonSituations":"Passing a computed property path that turned out empty (e.g. a name not resolved upstream). UI binding code forwarding an unset field reference. Default/placeholder values reaching the call.","solutions":["Validate propertyPath is non-null and non-empty before calling.","Resolve the property path from a known SerializedProperty.propertyPath rather than guessing.","Guard callers that may pass user/empty input with a string.IsNullOrWhiteSpace check."],"exampleFix":"// before\nOpenAndScrollTo(\"\"); // throws\n\n// after\nif (!string.IsNullOrWhiteSpace(propertyPath))\n    OpenAndScrollTo(propertyPath);","handlingStrategy":"validation","validationCode":"if (string.IsNullOrWhiteSpace(propertyPath))\n    throw new ArgumentException(\"propertyPath required\", nameof(propertyPath));\nGraphicsSettingsInspectorUtility.OpenAndScrollTo(propertyPath);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Derive propertyPath from SerializedProperty.propertyPath rather than guessing.","Guard call sites with IsNullOrWhiteSpace."],"tags":["graphics-settings","argument","property-path","validation"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}