Search Unity

Opening a Unity Package with TMPro into a new project has a problem

Discussion in 'UGUI & TextMesh Pro' started by roseportalgames, Jan 16, 2019.

  1. roseportalgames

    roseportalgames

    Joined:
    Aug 9, 2017
    Posts:
    173
    I've packaged one of my scenes including dependencies. I create a new project in Unity 2018.2.5f1 and import the package.

    Text Mesh Pro UGUI does show up in the inspector, but an empty window called "TMP Importer" keeps opening. The window has no visible content.

    The text itself is not visible in Game or Scene.

    I see these error messages:

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. TMPro.PackageResourceImporterWindow.GetGUIStyles () (at C:/Users/Aaron/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.textmeshpro@1.2.4/Scripts/Runtime/PackageResourceImporterWindow.cs:139)
    3. TMPro.PackageResourceImporterWindow.OnEnable () (at C:/Users/Aaron/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.textmeshpro@1.2.4/Scripts/Runtime/PackageResourceImporterWindow.cs:41)
    4. UnityEditor.EditorWindow:GetWindow()
    5. TMPro.PackageResourceImporterWindow:ShowPackageImporterWindow() (at C:/Users/Aaron/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.textmeshpro@1.2.4/Scripts/Runtime/PackageResourceImporterWindow.cs:14)
    6. TMPro.TMP_Settings:get_instance() (at C:/Users/Aaron/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.textmeshpro@1.2.4/Scripts/Runtime/TMP_Settings.cs:297)
    7. TMPro.TextMeshProUGUI:Awake() (at C:/Users/Aaron/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.textmeshpro@1.2.4/Scripts/Runtime/TMPro_UGUI_Private.cs:77)
    8. UnityEngine.GameObject:SetActive(Boolean)
    9. HUD:Start() (at Assets/Scripts/UI/HUD.cs:174)
    10.  
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. TMPro.TextMeshProUGUI.LateUpdate () (at C:/Users/Aaron/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.textmeshpro@1.2.4/Scripts/Runtime/TMPro_UGUI_Private.cs:1560)
    3.  
    etc.

    If I check Package Manager it does say that 1.2.4 is "current - verified".

    What's going on?

    Thanks. :)
     
    Last edited: Jan 16, 2019
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Can you post an image of the Importer Window?

    In order to use the TMP components as part of the package manager, the TMP Essential Resources need to be imported into the local project which is what that window pop'ing up is supposed to inform you about but it should not be empty.

    See if you get the same behavior creating a new empty project?
     
  3. roseportalgames

    roseportalgames

    Joined:
    Aug 9, 2017
    Posts:
    173
    Hi Stephan, Thanks for replying.
    I did create a new empty project and then import my package into that empty project. :) That's when it goes wrong.
    A purely empty project will function fine.

    Maybe there's something missing that wasn't included in the dependency of the package? But I do see the package and everything installed, so I don't know...

    Here's my screen. Whenever a TMPro component is used or called, the empty importer window shows up.

    Edit: Per your suggestion I've manually imported Essential Resources and restarted Unity, now the text does show up. So Essential Resources does not get included in package dependencies. :) Now I just keep getting this error:

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. TMPro.PackageResourceImporterWindow.GetGUIStyles () (at C:/Users/Aaron/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.textmeshpro@1.2.4/Scripts/Runtime/PackageResourceImporterWindow.cs:139)
    3. TMPro.PackageResourceImporterWindow.OnEnable () (at C:/Users/Aaron/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.textmeshpro@1.2.4/Scripts/Runtime/PackageResourceImporterWindow.cs:41)
    4.  
    I'm not sure how to fix that?

    Anyway, as you can see the TMPro Importer window was empty so I hope I helped in some way with the bug report.
     

    Attached Files:

    Last edited: Jan 16, 2019
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    What is your package?
    That is normal behavior as the TMP Essential Resources are required and have to be imported into the local project. Unless someone is using TMP, these resources are not needed and as such why they are not automatically imported and only are upon consent of the user via this window that shows up.

    I suspect something in your package is resulting in a conflict.

    Just for testing again, start with an empty project. The TMP package is included automatically. However, before importing your package, manually import the TMP Essential Resources via the "Window - TextMeshPro - Import TMP Essential Resources" menu.

    Also import the TMP Examples & Extras and then load a few of the example scenes to make sure everything works as expected.

    If everything works at this point, then import your package and look for any error that may occur at this point and report those back.
     
  5. roseportalgames

    roseportalgames

    Joined:
    Aug 9, 2017
    Posts:
    173
    I haven't tried it out yet with a New Project because I'm on a deadline, but I just wanted to follow-up on my previous post. The error I was still getting is coming from the empty TMPro Importer window. If I close that window, the TMPro GUI error message goes away. Makes sense.

    I also upgraded to TMPro 1.3 and things seem to work fine now.

    If I run into another issue I'll try your new project suggestion and report back here.

    As always, thank you so much for the fast help! You're the best!

    Edit: The package is just because I'm taking a part of my other game and publishing it as a standalone game.
     
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Feel free to follow up when you have time :)