Search Unity

TextMesh Pro Upgrading from Unity 2018.4 to Unity 2019.4

Discussion in 'UGUI & TextMesh Pro' started by Stephan_B, Feb 14, 2021.

  1. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    When upgrading from Unity 2018.4 to Unity 2019.4, please make sure that you also upgrade the TMP package to the corresponding version of the package for Unity 2019.4 before making any changes to your project.

    If you were using version 1.5.x of the TMP package in Unity 2018.4, you will need to install the corresponding version 2.1.x via the Package Manager in Unity 2019.4.

    This is especially important as the older version 2.0.1 of the TMP package will be installed by default in 2019.4. As such, if you were using version 1.5.x of the TMP package in Unity 2018.4, this will result in a downgrade of the TMP package resulting in potential issues including incorrect text alignment.

    Provided you do not make any changes to scenes, prefabs and assets before updating to the corresponding version of the TMP package for 20194.4, everything should be fine. You may need to re-open a previously loaded scene but that's about it.
     
  2. lucianlpt

    lucianlpt

    Joined:
    Dec 16, 2020
    Posts:
    5
    Hey, Stephan. Thanks for this amazing tool!

    I'm currently investigating what a migration from 2018.4 to 2019.4 would imply and TMPro is the biggest bottleneck.
    I use the AssetStore TMPro version with some modifications (mostly bugfixes taken from TMPro forum), and I also have my own "GameText" component that derives from TMPro and allows me to dynamically change the font path based on some data - but both components are used.

    In your upgrade guide it's not clear whether the old TMPro should be deleted or not, before starting the migration.

    My second problem is that there are have lots of asset bundles that use both the TMPro and GameText components.
    I'm not sure I can gather all of the sources for those bundles in order to rebuild them with the newer GUID, although that'll be the first thing I'll try.
    In case that fails, what do you suggest? If possible at all, could I somehow directly change the GUID of the TMPro component in the already-built asset bundles (probably with a python script)? Or is there something more that the GUID remapping tool needs to do when it's run it?
    The bottom line is rebuilding the asset bundles, especially the old ones, is not something I can easily do

    Thanks
     
  3. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Please make sure you backup the project.

    Yes. The old version of TextMesh Pro should be removed by deleting the "TextMesh Pro" folder. Be sure to backup any assets that you may have saved in this folder.

    The Project Files GUID Remapping Tool scans all project files looking for those specific GUIDs and replaces them by the newer ones. You could look at how this is handled in the TMP_PackageUtilities.cs and implement something similar to handle those bundles.

    I would suggest starting with manually editing the GUIDs in an AssetBundle to see if that will work and if it does implement some script to handle it.
     
  4. lucianlpt

    lucianlpt

    Joined:
    Dec 16, 2020
    Posts:
    5
    Thanks. The GUID part is clear now.

    Although I'm aware the old TMPro needs to be removed, my question was when should it be removed during the migration process: before, after or at a specific step in your guide?
     
  5. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    As per step 5 and 6 in the guide, just after you open the project in the newer version of Unity, you should then remove the old version of the TMP package as until you do so you will be getting lots of errors in the console.
     
    lucianlpt likes this.
  6. lucianlpt

    lucianlpt

    Joined:
    Dec 16, 2020
    Posts:
    5
    Hello @Stephan_B
    We need to change the GUIDs of some assets outside Unity. Would this work?:
    1. Gather all mappings from PackageConversionData.json and PackageConversionData_Assets.json.
    2. Iterate through all files and replace every occurrence of the old guid with the new one.

    Another thing, I see there are 2 entries with the same name in PackageConversionData.json:
    {
    "referencedResource": "TextMeshPro.cs",
    "target": "guid: 1a1578b9753d2604f98d608cb4239e2f",
    "replacement": "guid: 9541d86e2fd84c1d9990edf0852d74ab"
    },
    {
    "referencedResource": "TextMeshPro.cs",
    "target": "fileID: -806885394, guid: 89f0137620f6af44b9ba852b4190e64e",
    "replacement": "fileID: 11500000, guid: 9541d86e2fd84c1d9990edf0852d74ab"
    },
    Should I treat these differently?

    BTW, we've successfully migrated the assets that are already in the project using your mapping tool. If it was a pure C# script, we could've used it directly
     
    Last edited: Apr 23, 2021
  7. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The process you have outlined should work.

    The reason for the two set of GUIDs is because some users (for some reason) at some point manually re-assigned missing scripts to objects but using the GUID from the Editor assembly instead of the Runtime Assembly. Ie. The legacy TMP package include both an Editor .dll and a runtime .dll.

    Just check if you see any instances of both sets of GUIDs being used in the external code. Most likely you will only find one.
     
    Last edited: Apr 24, 2021
    lucianlpt likes this.
  8. kaushikbhatt_gamdeve

    kaushikbhatt_gamdeve

    Joined:
    Aug 19, 2019
    Posts:
    4
    We are upgrading Unity from 2019.4.21 to 25f1 and dont see option to downgrade TMPro to 2.1.3 which we had earlier. The issue is that once I upgrade it give me an error with a particular variable missing form TMPro.
    error CS0103: The name 'm_input_CharArray' does not exist in the current context
    Seems m_input_CharArray is either removed or its accessibility has changed. I could not find it in the source though. Just trying to figure out how we can get the same info from somewhere else.

    Additionally the package manager doesn't show an option on 25f1 to downgrade below 2.1.4. I can only see 3 versions; 2.14, 2.1.5 and 2.1.6
     
  9. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    You should be able edit the "Packages/manifest.json" to specify version 2.1.3.

    protected char[] m_input_CharArray = new char[256]; // This array hold the characters from the SetText();

    The above was removed as I have reworked the internal parsing to improve functionality between the various functions used to set the text and to help reduce memory overhead. See the ChangeLog for 2.1.4.