Steps to reproduce:
1. Create new Unity project
2. Open Build Profiles window
3. In Build Profiles window press “Add Build Profiles”
4. Add Windows Build Profile
5. Once added, press “Add Settings”
6. Add “Player Settings”
7. Expand “Player Settings”
8. Scroll down and find “Additional Compiler Arguments”
9. Press “+”
10. Do not apply changes
11. Scroll up to find and press on kebab button next to “Player Settings”
12. Select “Reset”
13. In “Reset Settings” pop-up press “Reset”
14. In “Scripting Define Symbols Have Been Modified” press “Apply”
15. Observe the Console window
Actual results: "NullReferenceException: Object reference not set to an instance of an object" error is thrown in the Console window
Expected results: No errors should be thrown in the Console window, applying empty lists should not be allowed
Reproducible with versions: 6000.3.0b10, 6000.4.0a4, 6000.5.0a1
Can’t test with versions: 6000.2.8f1 and lower (kebab menu item doesn’t have “Reset”)
Tested on (OS): Windows 11, macOS Silicon Tahoe 26.0
Error:
- NullReferenceException: Object reference not set to an instance of an object
UnityEditor.SerializedPropertyExtensions.TryGetMapEntry (UnityEditor.SerializedProperty map, System.String key, UnityEditor.SerializedProperty& entry) (at /Users/bokken/build/output/unity/unity/Editor/Mono/SerializedPropertyExtensions.cs:16)
UnityEditor.SerializedPropertyExtensions.SetMapValue (UnityEditor.SerializedProperty map, System.String key, System.String[] value) (at /Users/bokken/build/output/unity/unity/Editor/Mono/SerializedPropertyExtensions.cs:145)
UnityEditor.PlayerSettingsEditor.SetAdditionalCompilerArgumentsForGroup (UnityEditor.Build.NamedBuildTarget buildTarget, System.String[] arguments) (at /Users/bokken/build/output/unity/unity/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsEditor.cs:3572)
UnityEditor.PlayerSettingsEditor.HandlePendingChangesRequiringRecompilation () (at /Users/bokken/build/output/unity/unity/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsEditor.cs:941)
UnityEditor.PlayerSettingsEditor.OnDisable () (at /Users/bokken/build/output/unity/unity/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsEditor.cs:781)
UnityEditor.GenericMenu:CatchMenu(Object, String[], Int32) (at /Users/bokken/build/output/unity/unity/Editor/Mono/GUI/GenericMenu.cs:162)