Search Unity

MISSINGREFERENCEEXCEPTION occurs on selecting a TMP dropdown in the hierarchy after a play occurs

Discussion in 'UGUI & TextMesh Pro' started by jrwiegelmann, Aug 14, 2019.

  1. jrwiegelmann

    jrwiegelmann

    Joined:
    Oct 29, 2017
    Posts:
    4
    Hi,

    Continuous multiple MissingReferenceException errors occur after running a scene with TMP dropdown GameObject, once a TMP dropdown is selected in the hierarchy

    This problem seems similar to one already reported as solved:
    https://issuetracker.unity3d.com/is...n-occurs-on-playing-a-scene-with-tmp-dropdown

    Deactivating the TMP_dropdown script prevents the errors. Switching to package 1.3.0 returns normal function.

    Steps to repro:
    1. create a new project
    2. Hierarchy > right-click > TMP drop down
    3. Import TMP essential
    4. Play scene
    5.select dropdown in the hierarchy

    Actual Result:
    MissingReferenceException (and other errors) continuously occur:

    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 C:/buildslave/unity/build/Extensions/guisystem/UnityEditor.UI/UI/SelectableEditor.cs:321)
    UnityEditor.SceneView.CallOnSceneGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2848)
    UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2125)
    UnityEditor.SceneView.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:1986)
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <df7127ba07dc446d9f5831a0ec7b1d63>: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 <df7127ba07dc446d9f5831a0ec7b1d63>:0)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <df7127ba07dc446d9f5831a0ec7b1d63>:0)
    UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:342)
    UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:336)
    UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:310)
    UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect, System.Boolean customBorder, System.Boolean floatingWindow, System.Boolean isBottomTab) (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:361)
    UnityEditor.DockArea.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:320)
    UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:244)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced.
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    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 C:/buildslave/unity/build/Extensions/guisystem/UnityEditor.UI/UI/SelectableEditor.cs:321)
    UnityEditor.SceneView.CallOnSceneGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2848)
    UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2125)
    UnityEditor.SceneView.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:1986)
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <df7127ba07dc446d9f5831a0ec7b1d63>: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 <df7127ba07dc446d9f5831a0ec7b1d63>:0)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <df7127ba07dc446d9f5831a0ec7b1d63>:0)
    UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:342)
    UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:336)
    UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:310)
    UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect, System.Boolean customBorder, System.Boolean floatingWindow, System.Boolean isBottomTab) (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:361)
    UnityEditor.DockArea.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:320)
    UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:266)
    UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:438)
    UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent () (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:412)
    UnityEngine.Experimental.UIElements.ImmediateStylePainter.DrawImmediate (System.Action callback) (at C:/buildslave/unity/build/Modules/UIElements/ImmediateStylePainter.cs:113)
    UnityEngine.Experimental.UIElements.IMGUIContainer.DoRepaint (UnityEngine.Experimental.UIElements.IStylePainter painter) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:98)
    UnityEngine.Experimental.UIElements.VisualElement.Repaint (UnityEngine.Experimental.UIElements.IStylePainter painter) (at C:/buildslave/unity/build/Modules/UIElements/VisualElement.cs:862)
    UnityEngine.Experimental.UIElements.VisualTreeRepaintUpdater.PaintSubTree (UnityEngine.Experimental.UIElements.VisualElement root, UnityEngine.Matrix4x4 offset, System.Boolean shouldClip, System.Boolean shouldCache, UnityEngine.Rect currentGlobalClip) (at C:/buildslave/unity/build/Modules/UIElements/VisualTreeRepaintUpdater.cs:310)
    UnityEngine.Experimental.UIElements.VisualTreeRepaintUpdater.PaintSubTreeChildren (UnityEngine.Experimental.UIElements.VisualElement root, UnityEngine.Matrix4x4 offset, System.Boolean shouldClip, System.Boolean shouldCache, UnityEngine.Rect textureClip) (at C:/buildslave/unity/build/Modules/UIElements/VisualTreeRepaintUpdater.cs:328)
    UnityEngine.Experimental.UIElements.VisualTreeRepaintUpdater.PaintSubTree (UnityEngine.Experimental.UIElements.VisualElement root, UnityEngine.Matrix4x4 offset, System.Boolean shouldClip, System.Boolean shouldCache, UnityEngine.Rect currentGlobalClip) (at C:/buildslave/unity/build/Modules/UIElements/VisualTreeRepaintUpdater.cs:314)
    UnityEngine.Experimental.UIElements.VisualTreeRepaintUpdater.Update () (at C:/buildslave/unity/build/Modules/UIElements/VisualTreeRepaintUpdater.cs:35)
    UnityEngine.Experimental.UIElements.VisualTreeUpdater.UpdateVisualTree () (at C:/buildslave/unity/build/Modules/UIElements/VisualTreeUpdater.cs:70)
    UnityEngine.Experimental.UIElements.Panel.Repaint (UnityEngine.Event e) (at C:/buildslave/unity/build/Modules/UIElements/Panel.cs:507)
    UnityEngine.Experimental.UIElements.UIElementsUtility.DoDispatch (UnityEngine.Experimental.UIElements.BaseVisualElementPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:230)
    UnityEngine.Experimental.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:68)
    UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)

    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 C:/buildslave/unity/build/Extensions/guisystem/UnityEditor.UI/UI/SelectableEditor.cs:321)
    UnityEditor.SceneView.CallOnSceneGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2848)
    UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2125)
    UnityEditor.SceneView.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:1986)
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <df7127ba07dc446d9f5831a0ec7b1d63>: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 <df7127ba07dc446d9f5831a0ec7b1d63>:0)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <df7127ba07dc446d9f5831a0ec7b1d63>:0)
    UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:342)
    UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:336)
    UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:310)
    UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect, System.Boolean customBorder, System.Boolean floatingWindow, System.Boolean isBottomTab) (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:361)
    UnityEditor.DockArea.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:320)
    UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:266)
    UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:438)
    UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:421)
    UnityEngine.Experimental.UIElements.IMGUIContainer.HandleEvent (UnityEngine.Experimental.UIElements.EventBase evt) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:401)
    UnityEngine.Experimental.UIElements.EventDispatcher.PropagateEvent (UnityEngine.Experimental.UIElements.EventBase evt) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:754)
    UnityEngine.Experimental.UIElements.EventDispatcher.ProcessEvent (UnityEngine.Experimental.UIElements.EventBase evt, UnityEngine.Experimental.UIElements.IPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:599)
    UnityEngine.Experimental.UIElements.EventDispatcher.Dispatch (UnityEngine.Experimental.UIElements.EventBase evt, UnityEngine.Experimental.UIElements.IPanel panel, UnityEngine.Experimental.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:307)
    UnityEngine.Experimental.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.Experimental.UIElements.EventBase e, UnityEngine.Experimental.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/Panel.cs:176)
    UnityEngine.Experimental.UIElements.UIElementsUtility.DoDispatch (UnityEngine.Experimental.UIElements.BaseVisualElementPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:245)
    UnityEngine.Experimental.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:68)
    UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)

    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 C:/buildslave/unity/build/Extensions/guisystem/UnityEditor.UI/UI/SelectableEditor.cs:321)
    UnityEditor.SceneView.CallOnSceneGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2848)
    UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2125)
    UnityEditor.SceneView.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:1986)
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <df7127ba07dc446d9f5831a0ec7b1d63>: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 <df7127ba07dc446d9f5831a0ec7b1d63>:0)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <df7127ba07dc446d9f5831a0ec7b1d63>:0)
    UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:342)
    UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:336)
    UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:310)
    UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect, System.Boolean customBorder, System.Boolean floatingWindow, System.Boolean isBottomTab) (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:361)
    UnityEditor.DockArea.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:320)
    UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:266)
    UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:438)
    UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:421)
    UnityEngine.Experimental.UIElements.EventDispatcher.PropagateToIMGUIContainer (UnityEngine.Experimental.UIElements.VisualElement root, UnityEngine.Experimental.UIElements.EventBase evt) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:692)
    UnityEngine.Experimental.UIElements.EventDispatcher.PropagateToIMGUIContainer (UnityEngine.Experimental.UIElements.VisualElement root, UnityEngine.Experimental.UIElements.EventBase evt) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:704)
    UnityEngine.Experimental.UIElements.EventDispatcher.ProcessEvent (UnityEngine.Experimental.UIElements.EventBase evt, UnityEngine.Experimental.UIElements.IPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:650)
    UnityEngine.Experimental.UIElements.EventDispatcher.Dispatch (UnityEngine.Experimental.UIElements.EventBase evt, UnityEngine.Experimental.UIElements.IPanel panel, UnityEngine.Experimental.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:307)
    UnityEngine.Experimental.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.Experimental.UIElements.EventBase e, UnityEngine.Experimental.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/Panel.cs:176)
    UnityEngine.Experimental.UIElements.UIElementsUtility.DoDispatch (UnityEngine.Experimental.UIElements.BaseVisualElementPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:245)
    UnityEngine.Experimental.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:68)
    UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)


    Expected Result:
    no errors

    Occurring with:
    2018.4.6f1

    TextMeshPro Package Version:
    1.4.1

    Working with TMP Package:
    1.3.0


    Environment:
    Only on windows
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Please try the same steps but first import the TMP Essential Resources. Then create the TMP Drop Down.
     
  3. jrwiegelmann

    jrwiegelmann

    Joined:
    Oct 29, 2017
    Posts:
    4
    Thanks for the prompt response - I just tried your suggestion and the same error behaviour occurs
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Just created a new project in Unity 2018.4.6 and made sure it is using TextMesh Pro 1.4.1.

    Imported the TMP Essential Resources and then created a TMP Drop Down and everything worked as expected in and out of Play mode.

    Close Unity and then see if deleting the global package cache for TextMesh Pro resolves the issue. On Windows, the global package cache is located in "...\AppData\Local\Unity Cache\cache". Individual packages are in the packages sub folder. When testing, I typically delete the whole cache but you can delete just the TMP packages.

    I have had a previous report of this but it was resolved by importing the TMP Essential Resources first and before creating a TMP Drop Down.
     
    Beano1 likes this.
  5. jrwiegelmann

    jrwiegelmann

    Joined:
    Oct 29, 2017
    Posts:
    4
    closed unity, cleared out the whole cache, created a new project as per above - still the behaviour is the same unfortunately. Thanks for the fast response with the suggestions
     
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Can you submit a bug report with the project the produces the errors. Since I cannot reproduce the issue on my end, this will enable me to figure out why this occurs on your end.

    Please provide me with the Case # as soon as you have it.
     
  7. jrwiegelmann

    jrwiegelmann

    Joined:
    Oct 29, 2017
    Posts:
    4
    Case 1176796
     
  8. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Just looked at the provided project and no errors when selecting / using the Drop Down before / during or after entering / leaving Playmode in the Scene Hierarchy as seen in the image below

    upload_2019-8-15_19-24-5.png

    Given the provided project behaved as expected, it rules out something specific to the project thus pointing back to the package cache or something local.

    Please try again the following steps. Sorry.

    (1) Close Unity.
    (2) Delete the Global package cache folder located in "...\AppData\Local\Unity Cache\cache"
    (3) Using the same project you provided in this case, delete the Library folder / Logs and Temp folders.
    (4) Also delete the TextMesh Pro folder inside Assets. This should leave you with an empty project.
    (5) Open Unity. The packages will be downloaded and should be correct in the event that was an issue in the Global cache.
    (6) Once Unity has loaded, Import the TMP Essential Resources.
    (7) Create a Drop Down and see if the issue shows up again.
     
  9. paragyogi

    paragyogi

    Joined:
    Oct 4, 2018
    Posts:
    19
    Hi I found the root Cause
    By Mistake Visualise was Disabled for drop down
    As soon as it is enabled issue was gone
     
    Last edited: Sep 25, 2019
  10. DTM1218

    DTM1218

    Joined:
    Oct 27, 2017
    Posts:
    3
    I'm bumping this thread to say I encountered something similar in Version 2.0.1.
    I had navigation visualization on when I deleted a TMP_Dropdown that wasn't working, and when I created a new one, the MissingReferenceException popped up. Once I turned off the visualize mode, the error went away.
    The visualization seems to be looking for the deleted TMP_Dropdown, as it also occurs on a toggle that navigated to the old TMP_Dropdown.
     
    dmlo and andreiagmu like this.
  11. andreiagmu

    andreiagmu

    Joined:
    Feb 20, 2014
    Posts:
    175
    I was having the same issue with TMP_Dropdown, in my case the issue was happening because I'm using the "Enter Play Mode" options.
    This bug was fixed in a recent preview version of TMP, so I updated it to v2.1.0-preview5. Now, the errors don't happen anymore. :)

    From TMP's changelog:
    Fixed potential Null Reference Exception with the TMP DropDown that could occur when using the experimental Editor "Enter Play Mode" feature. Case #1207915
     
  12. LukasNysted

    LukasNysted

    Joined:
    Sep 5, 2017
    Posts:
    5
    So we've been having this issue as well.
    After digging around a bit in the TMP_Dropdown code I have discorvered that TMP_Dropdown overrides Selectables OnDisable, without having a base.OnDisable call in it.
    This leads to the dropdown never being removed from the internal unity array of active selectables (that it uses to update and visualise navigation) and that is problematic.
    So just add a base.OnDisable() call to the beginning of OnDisable in TMP_Dropdown, at least that did it for us.
     
    dmlo likes this.
  13. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    The above fix was done in some prior release of TMP but that is the issue affecting sub objects which can occur when using the drop down when a fallback ends up being used. The solution is essentially the same as referenced here which is to call base.OnDisable() in the TMP_SubMeshUI.cs script as per this post.
     
  14. LukasNysted

    LukasNysted

    Joined:
    Sep 5, 2017
    Posts:
    5
    I'm sorry but I don't think I understood this at all.
    TMP_SubMeshUI is not a selectable as far as I can see so I don't understand how that issue overlaps with this?
    Are you saying that the base.OnDisable call was removed from TMP_Dropdown to prevent the TMP_SubmeshUI from causing issues, or what do you mean?
     
    dmlo likes this.
  15. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    In a previous version of the TMP package, there was an issue related to not calling base.OnDisable() on the DropDown itself. This was fixed in a subsequent release of the TMP package.

    In the latest release of the TMP package (version 1.5.0-preview.5), when a TMP DropDown ends up using a fallback font asset which ends up creating a sub mesh object, the CanvasRenderer of this sub mesh object is added to a list tracked by the UI system. Now since base.OnDisable() is not called on this sub mesh object when the TMP DropDown is disabled, we get several errors related to the Raycaster and this CanvasRenderer having been destroyed, etc... Ie. base.OnDisable() needs to be call by the sub mesh object.

    This will be resolved in the next package release which will be preview 6.
     
    centaurianmudpig likes this.
  16. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Preview 7 of the latest version of TMP is now available. I ended up having to skip Preview 6 due to a publishing issue which required I scrap Preview 6 so Preview 7 is it :)
     
  17. UncleAlias

    UncleAlias

    Joined:
    Aug 18, 2017
    Posts:
    27
    I've had success with this method and it worked for a while but now something keeps changing TMP_Dropdown.cs back, deleting base.OnDisable(). It's happened twice in as many days. I don't think TextMeshPro has updated. Any ideas why this might happen?
     
  18. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Please test with Preview 14 of the TMP package and let me know if you still run into this issue.

    What version of Unity are you using?
     
  19. UncleAlias

    UncleAlias

    Joined:
    Aug 18, 2017
    Posts:
    27
    2019
    I'll try that. I'm using Unity 2012.3.12.f1.
     
  20. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,735
    If anyone else encounters this problem, I can confirm that it doesn't occur in preview 14.
     
  21. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,735
    However, preview 14 seems to be bugged in other ways. I'm now getting regular random index out of range errors when it's checking for closing style tags.

    IndexOutOfRangeException: Index was outside the bounds of the array.
    TMPro.TMP_Text.ReplaceClosingStyleTag (System.Text.StringBuilder& sourceText, System.Int32 srcIndex, TMPro.TMP_Text+UnicodeChar[]& charBuffer, System.Int32& writeIndex) (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.14/Scripts/Runtime/TMP_Text.cs:4205)
    TMPro.TMP_Text.StringBuilderToInternalParsingBuffer (System.Text.StringBuilder sourceText, TMPro.TMP_Text+UnicodeChar[]& internalParsingArray) (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.14/Scripts/Runtime/TMP_Text.cs:3249)
    TMPro.TMP_Text.SetText (System.Text.StringBuilder text) (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.14/Scripts/Runtime/TMP_Text.cs:2201)
    LogWindow.DisplayText () (at Assets/Garador/UI/LogWindow.cs:156)
    LogWindow.AddText (System.Boolean combatLog, System.Boolean showHeadsUp) (at Assets/Garador/UI/LogWindow.cs:207)
    LogWindow.AddText (System.String text, System.Boolean combatLog, System.Boolean showHeadsUp) (at Assets/Garador/UI/LogWindow.cs:182)
    Quests.ClickableItems.AddItemsAction.<ShowDefaultPickupMessages>b__14_0 () (at Assets/Garador/Clickable Scene Objects System/AddItemsAction.cs:128)
    MonBehaviourExtensions+<InvokeRedirect>d__3.MoveNext () (at Assets/Extensions/MonBehaviourExtensions.cs:41)
    UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <23a7799da2e941b88c6db790c607d655>:0)


    And the problem persists even after using the Package Manager to revert to Version 2.1.0, not good! :(

    Edit: Just realised that V2.0.1 is the verified version. I'll see if downgrading back to that fixes the IndexOutOfRangeExceptions.

    Edit2: Downgrading to V2.0.1 lost most of the text alignment settings for the TMP text objects in the existing scenes, such a pain!
    I'll try again but this time completely uninstall the unverified version before re-installing the verified version. If that fails I'll just have to revert to the commit before I upgraded to preview 14. Unfortunately that will mean having to redo a fair bit of work that was applied after the update.

    Edit3: That didn't work, the text alignment settings were still lost, so the only option is using source control to revert back to a working version. My advice to anyone reading this is don't install preview 14!

    @Stephan_B Any timeframe on when the TMP_Dropdown/Visualisation bug will be fixed in a stable TMPro version for Unity 2019?
     
    Last edited: Jul 15, 2020
  22. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    This is the first report of any issue related to the TMP Dropdown in any recent preview releases and Preview 14.

    The drop down doesn't use any styles so not sure why this error would occur. Are you using styles in your drop down text?

    If you are able to reliably reproduce this issue, please provide me with the steps to reproduce or submit a bug report with the project and steps.

    In terms of the downgrade, alignment has been changed to use two serialized properties to provide independent control over horizontal and vertical alignment. Going back to an older version will cause issues as alignment was converted.

    You should be using version 2.1.0 with Unity 2019.x. If you can get me the steps to reproduce the issue, I will most likely be able to provide you with code changes to fix it. I just need to be able to reproduce the issue.

    Make sure that you updated the TMP Essential Resources as you upgraded to 2.1.0 and see if that resolved your issue.
     
  23. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,735
    I've done as you suggested, but the errors still occur. To be clear though, these errors aren't connected to the TMP_Dropdown, they occur when trying to set text on a TMP_Text component, but not every time and not always at the same point in the program.

    Also as evident from the second crash example below, it isn't just happening in my own code.

    Furthermore, I can't recreate this behaviour in a clean project, but I have no such issues in my current project using TMP V2.0.1

    I'd like to try and get this resolved one way or another, as I don't want to be stuck on an increasingly outdated version of TMPro, so I'm hoping you can come up with something else to try.

    Many thanks

    Crash example 1, using SetText() with a stringbuilder argument
    IndexOutOfRangeException: Index was outside the bounds of the array.
    TMPro.TMP_Text.ReplaceClosingStyleTag (System.Text.StringBuilder& sourceText, System.Int32 srcIndex, TMPro.TMP_Text+UnicodeChar[]& charBuffer, System.Int32& writeIndex) (at Library/PackageCache/com.unity.textmeshpro@2.1.0/Scripts/Runtime/TMP_Text.cs:4189)
    TMPro.TMP_Text.StringBuilderToInternalParsingBuffer (System.Text.StringBuilder sourceText, TMPro.TMP_Text+UnicodeChar[]& internalParsingArray) (at Library/PackageCache/com.unity.textmeshpro@2.1.0/Scripts/Runtime/TMP_Text.cs:3233)
    TMPro.TMP_Text.SetText (System.Text.StringBuilder text) (at Library/PackageCache/com.unity.textmeshpro@2.1.0/Scripts/Runtime/TMP_Text.cs:2185)
    LogWindow.DisplayText () (at Assets/Garador/UI/LogWindow.cs:156)
    LogWindow.AddText (System.Boolean combatLog, System.Boolean showHeadsUp) (at Assets/Garador/UI/LogWindow.cs:207)
    LogWindow.AddText (System.String text, System.Boolean combatLog, System.Boolean showHeadsUp) (at Assets/Garador/UI/LogWindow.cs:182)
    CashQuestReward.Collect () (at Assets/Garador/Quests/CashQuestReward.cs:15)
    Quest.DoRewards () (at Assets/Garador/Quests/Quest.cs:149)
    Quest.CompleteQuest () (at Assets/Garador/Quests/Quest.cs:126)
    QuestDialogPage.OnDialogButtonClicked (NPCDialog.Dialog+Buttons button) (at Assets/Garador/NPC Dialog System/QuestDialogPage.cs:152)
    NPCDialog.Dialog.OnButtonClicked (NPCDialog.Dialog+Buttons button) (at Assets/Garador/NPC Dialog System/Dialog.cs:180)
    NPCDialog.DialogButton.OnButtonClick () (at Assets/Garador/NPC Dialog System/DialogButton.cs:15)
    UnityEngine.Events.InvokableCall.Invoke () (at <23a7799da2e941b88c6db790c607d655>:0)
    UnityEngine.Events.UnityEvent.Invoke () (at <23a7799da2e941b88c6db790c607d655>:0)
    UnityEngine.UI.Button.Press () (at C:/Program Files/Unity/Hub/Editor/2019.3.14f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Button.cs:68)
    UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at C:/Program Files/Unity/Hub/Editor/2019.3.14f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Button.cs:110)
    UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/Program Files/Unity/Hub/Editor/2019.3.14f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:50)
    UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at C:/Program Files/Unity/Hub/Editor/2019.3.14f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:261)
    UnityEngine.EventSystems.EventSystem:Update() (at C:/Program Files/Unity/Hub/Editor/2019.3.14f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:377)

    Example 2, crash doesn't seem to originate from my code
    IndexOutOfRangeException: Index was outside the bounds of the array.
    TMPro.TMP_Text.ReplaceClosingStyleTag (System.String& sourceText, System.Int32 srcIndex, TMPro.TMP_Text+UnicodeChar[]& charBuffer, System.Int32& writeIndex) (at Library/PackageCache/com.unity.textmeshpro@2.1.0/Scripts/Runtime/TMP_Text.cs:3804)
    TMPro.TMP_Text.StringToInternalParsingBuffer (System.String sourceText, TMPro.TMP_Text+UnicodeChar[]& internalParsingArray) (at Library/PackageCache/com.unity.textmeshpro@2.1.0/Scripts/Runtime/TMP_Text.cs:3032)
    TMPro.TMP_Text.ParseInputText () (at Library/PackageCache/com.unity.textmeshpro@2.1.0/Scripts/Runtime/TMP_Text.cs:1884)
    TMPro.TextMeshProUGUI.OnPreRenderCanvas () (at Library/PackageCache/com.unity.textmeshpro@2.1.0/Scripts/Runtime/TMPro_UGUI_Private.cs:1608)
    TMPro.TextMeshProUGUI.Rebuild (UnityEngine.UI.CanvasUpdate update) (at Library/PackageCache/com.unity.textmeshpro@2.1.0/Scripts/Runtime/TextMeshProUGUI.cs:224)
    UnityEngine.UI.CanvasUpdateRegistry.PerformUpdate () (at C:/Program Files/Unity/Hub/Editor/2019.3.14f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/CanvasUpdateRegistry.cs:210)
    UnityEngine.Canvas:SendWillRenderCanvases()
     
  24. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Did you update the TMP Essential Resources?

    Is there a style sheet assigned in your TMP Settings?

    Does this style sheet contain the Normal style?

    Are you using or referencing a style in your text?

    Is this issue isolated to a specific text object or text content? What is the text that is causing this error?

    Can you submit a bug report with the project and steps to reproduce?
     
    Last edited: Jul 15, 2020
  25. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,735
    I did update the essential resources.

    I'll get back to you tomorrow when I can check for certain about the style sheet, but I'm fairly sure there isn't as I've never used one.

    The issue happens to any TMP_Text in the project and with no specific text. Also if you check the second crash example in my previous post you can see from the call stack that it wasn't caused by one of my scripts.

    I'll try submitting a bug report, but due to the size of the project the reporting system might struggle to upload it (it did last time I tried).
     
  26. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    If you are able to submit the bug report, please provide me with the Case # once you have it from Unity.

    I should be able to resolve this quickly as soon as I am able to reproduce the issue.
     
  27. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,735
    I can confirm that I'm not using style sheets. The only style sheet in the project is the default one installed with TMPro and even that isn't assigned to any of my text mesh objects.

    I'm currently trying to upload a bug report, with a version of the project that has a button on the main menu, which if clicked a few times, reliably reproduces the bug.

    I'll let you know when I have a case number.

    Thanks for you help.
     
    Stephan_B likes this.
  28. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,735
    Bug report submitted Case #1263787

    Let me know if you need anything else to help track down the problem.

    Many thanks
     
  29. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Thank you for the time you took to submit the bug report and project for me to look at. As usual, this has made it easy to identify the source of the issue.

    The issue is due to the fact that a lot of your text contains "</color></size></style></s></u></b></i></link>" where although you are not using the <style> tag, you are using </style> which is not being handled correctly in the depth tracking as these tags which is necessary since they can be nested.

    I have made the necessary changes on my end to resolve this issue. It will require an update of the TMP package which I will try to release over the weekend or early next week.

    Can you provide some insight as to why you append all these extra tags at the end of the text?
     
  30. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,735
    Thanks for looking into this so quickly, very much appreciated :)

    The reason I append all the closing tags, is because it allows me to use a single function to set a TMP_text's text with an undetermined set of rich text tags being passed into it. The string being passed in can be constructed from a number of other functions that have no knowledge of what the current string contents are other than what they add to it. So it is easiest to have the method that sets the text be responsible for closing any rich text tags that might be in the string, so I append all the possible tags that I know I might be currently using.

    Doing it this way the methods that construct the string can just append their contents and the closing tags are added to the final string just before it is used to set the TMP_Text.text. Otherwise, the methods that construct the string would have to search for the start of any existing closing tags and insert their contents there.

    I hope that makes some kind of sense :)
     
  31. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,735
    Hi Stephan, any news on when the update will be available?
     
  32. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Working on it as we speak.
     
    Munchy2007 likes this.
  33. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,735
    Version 2.1.1 has fixed the issues I was having. Thanks for sorting them out :)
     
    Stephan_B likes this.