Search Issue Tracker

Fixed in 2021.2.X

Votes

0

Found in

2021.2.0a12

Issue ID

1326314

Regression

No

[Editor] Null reference exception occurs when changing color for a gradient key

IMGUI

-

Null reference exception occurs when changing color for a gradient key. While creating new keys, and opening the color editor quickly, it is possible to deselect the active key.

Steps to Repro:
1. Create a new project
2. Hierarchy > right-click > Effects > Particle
3. Main particle settings > start color drop-down > change it gradient
4. Click on Color to open the gradient editor window
5. Create new and click on the key to open the color picker
6. Change the color
7. quickly repeat steps 5-6 again a few times

Note: Quickly drag the key down to move it out of the gradient box while opening the color

Actual Result:
Null reference exception occurs when the active key is deselected and the color is changed for it

Expected Result:
The user is unable to deselect the active key

Occurring in:
2021.2.0a12 2021.1.f1, 2020.2.7f1, 2019.4.21f1, 2018.4.31f1

Environment:
Windows 10, Mac 10.15

Stack Trace:
NullReferenceException: Object reference not set to an instance of an object
at UnityEditor.GradientEditor.ShowSwatchArray (UnityEngine.Rect position, System.Collections.Generic.List`1[T] swatches, System.Boolean isAlpha) [0x0051d] in <7294825e644243ba9cb7d5a161122672>:0
at UnityEditor.GradientEditor.OnGUI (UnityEngine.Rect position) [0x000aa] in <7294825e644243ba9cb7d5a161122672>:0
at UnityEditor.GradientPicker.OnGUI () [0x00124] in <7294825e644243ba9cb7d5a161122672>:0
at UnityEditor.HostView.OldOnGUI () [0x00052] in <7294825e644243ba9cb7d5a161122672>:0
at UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) [0x0022c] in <08c286338d234d9ab1a65978571f72f6>:0
at UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) [0x000c4] in <08c286338d234d9ab1a65978571f72f6>:0
at UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) [0x00015] in <08c286338d234d9ab1a65978571f72f6>:0
at UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) [0x00009] in <08c286338d234d9ab1a65978571f72f6>:0
at UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) [0x00029] in <08c286338d234d9ab1a65978571f72f6>:0
at UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) [0x00150] in <08c286338d234d9ab1a65978571f72f6>:0
at UnityEngine.UIElements.CommandEventDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) [0x00042] in <08c286338d234d9ab1a65978571f72f6>:0
at UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) [0x00025] in <08c286338d234d9ab1a65978571f72f6>:0
at UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) [0x00043] in <08c286338d234d9ab1a65978571f72f6>:0
at UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) [0x00046] in <08c286338d234d9ab1a65978571f72f6>:0
at UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) [0x0001a] in <08c286338d234d9ab1a65978571f72f6>:0
at UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) [0x000d8] in <08c286338d234d9ab1a65978571f72f6>:0
at UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) [0x0003d] in <08c286338d234d9ab1a65978571f72f6>:0
at UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) [0x0001a] in <08c286338d234d9ab1a65978571f72f6>:0
at UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) [0x00001] in <08c286338d234d9ab1a65978571f72f6>:0
at UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) [0x00010] in <ea2064d6d70e4d1381b89c77261e9037>:0

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.