Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question TextMesh Pro error when quitting game - The object of type 'Material' has been destroyed but...

Discussion in 'UGUI & TextMesh Pro' started by Gordon_G, Sep 23, 2021.

  1. Gordon_G

    Gordon_G

    Joined:
    Jun 4, 2013
    Posts:
    372
    MissingReferenceException: The object of type 'Material' 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.
    UnityEngine.Object.get_name () (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/UnityEngineObject.bindings.cs:194)
    TMPro.TMP_SubMeshUI.AddSubTextObject (TMPro.TextMeshProUGUI textComponent, TMPro.MaterialReference materialReference) (at Library/PackageCache/com.unity.textmeshpro@3.0.6/Scripts/Runtime/TMP_SubMeshUI.cs:215)

    I'm Using Unity 2020.3.11f1, with the latest TextMesh Pro (3.0.6) and the TMP Essential Resources imported.

    If it matters, I'm doing additive scene loading, and each scene has it's own Screen Space - Camera canvas. When a scene is additively loaded, I disable the scene camera and set the Canvas's camera to the main scene camera.

    The errors occur only when exiting the game in Play mode in the editor - I haven't tried a build.

    the thing is I don't have any script that is doing anything when I stop play mode except maybe a Pointer Down event listener on a UI button.

    Any ideas on what I can do the fix this, or why it is happening?
     
    Last edited: Sep 24, 2021
  2. Lux137

    Lux137

    Joined:
    Nov 2, 2021
    Posts:
    1
    Hello, I have the same problem. Have you solved this problem? May I ask how to solve it? Thanks!
     
  3. travismillerdev

    travismillerdev

    Joined:
    Feb 28, 2022
    Posts:
    3
  4. Lorin_Atzberger

    Lorin_Atzberger

    Joined:
    Dec 11, 2013
    Posts:
    119