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

Package: TextMeshPro

-

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 (14)

  1. 8265ed728f9082fadaae67772d4a3557?d=mm

    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...

  2. 0a849ceab55c1cee76e5780d0373b59c?d=mm

    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.

  3. 55644ae0afe11700b209c52199f7e90d?d=mm

    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.

  4. Fd9fa7a0e980926ac57eaf56468ec4ec?d=mm

    alfarza

    Nov 15, 2020 18:05

    the issue still exist.

  5. 36c65e3934745df83910152c6a077e4a?d=mm

    shubhamswaraj2021

    Aug 21, 2020 05:43

    good one <a href="https://www.lyricsauto.com">lyricsauto</a>

  6. 62471fc09be07f1b95d9646eeb947c53?d=mm

    MrSIiddes

    Jun 25, 2020 09:34

    @SPENCETT option works, only when I restart Unity I have to re-add it.

  7. 3bfa650228b5fdb2d3bdbe824523ae7d?d=mm

    abdjaouni

    Apr 19, 2020 22:19

    @SPENCETT thx man!

  8. F3bdc091233d9b4e4feabda7dc83289e?d=mm

    fgardler

    Apr 12, 2020 17:03

    Still present in 2019.3.7f1with TextMesh Pro 2.0.1
    Should not be marked FIXED

  9. 97b7e87d6d37b3fab3ac244de229cf6e?d=mm

    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.

  10. 44437b18408b0d51e5eb4b10ce1ab9bb?d=mm

    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

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.