Search Issue Tracker
Fixed
Votes
0
Found in [Package]
2.0.1
Issue ID
1163975
Regression
Yes
[TMP] MissingReferenceException occurs on playing a scene with TMP dropdown
Continuous multiple MissingReferenceException errors occur on running a scene with TMP dropdown GameObject
Steps to repro:
1. Open an attached project or create a new project
2. Hierarchy > right-click > TMP drop down
3. Import TMP essential
4. Play scene
Actual Result:
MissingReferenceException occurs
Expected Result:
The scene is played gracefully
Occurring with:
2019.3.0a7, 2019.2.0b7, 2019.1.4f1
TextMeshPro Package Version:
2.0.1, 1.4
Working with Package:
1.3
Environment:
Only on windows
Stack Trace:
Error 1:
MissingReferenceException: The object of type 'TMP_Dropdown' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEditor.UI.SelectableEditor.StaticOnSceneGUI (UnityEditor.SceneView view) (at <89d1aa06190749f989600312ab9200d3>:0)
UnityEditor.SceneView.CallOnSceneGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:3306)
UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2539)
UnityEditor.SceneView.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2400)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <a8ed250850854b439cedc18931a314fe>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <a8ed250850854b439cedc18931a314fe>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <a8ed250850854b439cedc18931a314fe>:0)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:337)
UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:331)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:307)
UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect, System.Boolean floatingWindow, System.Boolean isBottomTab) (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:373)
UnityEditor.DockArea.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:340)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:281)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Error 2:
GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced.
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Error 3:
MissingReferenceException: The object of type 'TMP_Dropdown' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEditor.UI.SelectableEditor.StaticOnSceneGUI (UnityEditor.SceneView view) (at <89d1aa06190749f989600312ab9200d3>:0)
UnityEditor.SceneView.CallOnSceneGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:3306)
UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2539)
UnityEditor.SceneView.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2400)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <a8ed250850854b439cedc18931a314fe>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
UnityEngine.UIElements.UIR.RenderChain.Render (UnityEngine.Rect topRect, UnityEngine.Matrix4x4 projection) (at C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRChainBuilder.cs:242)
UnityEngine.UIElements.UIRRepaintUpdater.DrawChain (UnityEngine.Rect topRect, UnityEngine.Matrix4x4 projection) (at C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRRepaintUpdater.cs:66)
UnityEngine.UIElements.UIRRepaintUpdater.Update () (at C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRRepaintUpdater.cs:54)
UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTree () (at C:/buildslave/unity/build/Modules/UIElements/VisualTreeUpdater.cs:72)
UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event e) (at C:/buildslave/unity/build/Modules/UIElements/Panel.cs:637)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:240)
UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:78)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)
Comments (15)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Opening Terrain Prefab in Prefab Editing Mode throws "NullReferenceException" error
- [Search] Dragging query pills put them behind the search text field
- A CustomPropertyDrawer that returns a PropertyField for a property named the same as a child field will not render all child fields
- Graphics Settings shows default values instead of the real values in the Rendering Debugger when Volume.profile is assigned via script
- Deleting multiple Tags throws “NullReferenceException”, and "Retrieving array element that was out of bounds" errors when holding the Enter key
davidosullivan
Jul 30, 2021 21:24
I was getting this in 2019.5.15f1 with TMP 2.0.1. I tried updating to 2.1.6 and THIS issue went away but literally all my TMPs then caused errors of ' IndexOutOfRangeException'. So I followed the advice to modify TMP_Dropdown.cs -> OnDisable() so that it called base.OnDisable() AT THE TOP of the method and I got all the IndexOutOfRangeException errors again but no 'MissingReferenceException' errors. I then put base.OnDisable() AT THE END of the method and did not get either of the errors. So I think this might be the correct fix...
ilyaz_khanMohd
Feb 21, 2021 12:27
Thanks to @SPENCETT
fixed this manually by adding base.OnDisable(); to Library\PackageCache\com.unity.textmeshpro@2.0.1\Scripts\Runtime\TMP_Dropdown.cs:460 in the OnDisable function.
spilucco
Jan 16, 2021 01:36
I wasn't able to use automatic navigation because of this. I solved the issue reading one of the comments here.
You can fix this manually by adding base.OnDisable() to Library\PackageCache\com.unity.textmeshpro@2.0.1\Scripts\RuntimeTMP_Dropdown.cs:460 in the OnDisable function.
alfarza
Nov 15, 2020 18:05
the issue still exist.
MrSIiddes
Jun 25, 2020 09:34
@SPENCETT option works, only when I restart Unity I have to re-add it.
abdjaouni
Apr 19, 2020 22:19
@SPENCETT thx man!
SorraTheOrc
Apr 12, 2020 17:03
Still present in 2019.3.7f1with TextMesh Pro 2.0.1
Should not be marked FIXED
spencett
Mar 11, 2020 17:58
Issue is present in 2019.3.2.0f1 with TMP package 2.0.1.
The problem is TMP_Dropdown has overrided the OnDisable function without calling base.OnDisable(). This prevents the call to Selectable.OnDisable() which decreases s_SelectableCount and removes it from its Selectables array. When you go into a new scene, the selectables are added but the Selectable pointer is wrong, thus the MissingReferenceException.
You can fix this manually by adding base.OnDisable() to Library\PackageCache\com.unity.textmeshpro@2.0.1\Scripts\RuntimeTMP_Dropdown.cs:460 in the OnDisable function.
paragyogi
Sep 25, 2019 12:25
Hi I found the root Cause
By Mistake Visualise was Disabled for drop down
As soon as it is enabled issue was gone
paragyogi
Sep 25, 2019 08:11
Removing Global Cache("...\AppData\Local\Unity\cache") Resolved my issue