Migrating from Legacy / Asset Store to Package Manager Releases

As per the title and assuming all goes well, a new version of TextMesh Pro will be included by default in Unity 2018.1. Most likely starting with Beta 2 or Beta 3. (See Updated Notes below about 2018.2 and additional information )

This new version of TMP will be made available via the new Unity Package Manager (also part of Unity 2018.1). These new Unity Package Manager (UPM) packages are shared between all projects. This new version of TMP includes source code and uses the new Assembly Definition feature introduced in Unity 2017.3.

Due to how this package manager works, it is important to understand this new version of TextMesh Pro will be using a completely different / unique set of GUIDs and FileIDs which was necessary to make sure it did not conflict with the current sets of GUIDs and FileIDs used by the source code and DLL only versions of TMP currently out there. As such project files and assets created with previous versions of TMP will require the use of a utility to convert these existing projects to use the new sets of GUIDs and FileIDs.

During the beta period for 2018.1, I would love to get your feedback and most importantly assistance to test this project conversion utility to make sure it correctly handles the conversion process.

My suggested upgrade steps are as follows but expect these may change based on your feedback.

  • Before installing Unity 2018.1 or newer, open your project in your current version of Unity and close all scenes you might have opened. Using “File → New Scene” will close current scenes. In this step we are trying to avoid having any TMP resources or DLLs loaded when you first open Unity 2018.1 or newer. Failing to do so will just confuse the crap out of Unity and make the upgrade process more complex.

  • Due to an important change in Unity 2018.3 related to Prefabs, you must switch Asset Serialization mode to Force Text in your current version of Unity prior to opening the project in Unity 2018.3 or newer releases of Unity.

  • Since the latest releases of the TMP package for Unity 2018.3 or newer require .Net 4.x, you should also change this in the Project Settings - Player - Other Settings.

  • As usual, please backup your project before upgrading to this new version of TMP and Unity 2018.1 or newer.

  • Install Unity 2018.1 or newer. Personally, I always install new major versions of Unity in separate folders which allows me to use multiple versions of Unity for testing and what not.

  • Open the latest release of Unity and expect to see lots of error messages since the older version and new versions of TMP are present thus resulting in class conflicts. This could be avoided by deleting the “TextMesh Pro” folder in step (1) but it isn’t necessary as once the previous / older version of TMP is removed by deleting the “TextMesh Pro” folder these errors will go away. That is provided you did close any open scene using TMP in step (1). Once the “TextMesh Pro” folder is deleted, Unity will go through an Assembly Reload and the new version of TMP will finally be loaded.

Note that I could have used a new namespace for this new version but this would have required updating all the scripts referencing the “TMPro” namespace which given these errors only show up during this upgrade process, going thru all the scripts to change the namespace would have been more complicated in my opinion.

  • Now we need to import the Essential Resources that TextMesh Pro needs. These are the default font asset, sprite asset, stylesheet, shaders, etc. You can add these to your project by going to the “Window - TextMeshPro - Import TMP Essential Resources” menu. These resources will be added to your project in the “TextMesh Pro” folder.

Note: These resources could have been contained inside the new TMP UPM package but these would have be hidden and given they would be inside a Resources folder to make it possible to access them at runtime, they would have been part of any build whether or not TMP is used. As such I thought it would be better to make those visible to users by adding them into the local project and giving you control over them.

  • Lastly, since this new version of TMP uses a new set of GUIDs and FileIDs, we will need to convert your existing project files and resources to use this new set. To convert the project, go to “Window - TextMeshPro - Project Files GUID Remapping Tool”. This will open the new Project GUID Remapping Tool which will enable you to Scan the Project to find the resources and files than need to be converted and then if you chose convert them to the new set of GUIDs and FileIDs used by this new version of TMP. Please be sure to following the instruction provided in the tool and to have made a backup of your project first.

Please provide feedback on this process and most importantly let me know if you run into any unforeseen issues. I have run through this process many times with various projects and it worked fine. On the other hand, “Murphy’s Law” is always in full force so provided you backed up your project first, we’ll be able to iron out whatever issues and make sure we get all these projects converted over nicely.

If you have any questions, suggestions, again please feel free to ask away.

Update Notes

  • Unity 2018.2 - The TMP UPM package is now included by default with Unity 2018.2. As such, if your project includes a previous version of the source code or dll version of TMP, you will be getting a lot of errors as a result of having two versions of the product in your project.

These errors are temporary and will go away once you remove the previous version of TMP and complete the upgrade / migration procedure outlined above.

  • The TMP UPM package (like all other packages) uses the new Assembly Definition feature (.asmdef) where the TMP scripts are compiled in their own assembly. There are two assemblies: Unity.TextMeshPro and Unity.TextMeshPro.Editor.

If your scripts also use assembly definitions, you will need to manually edit your .asmdef files to add a reference to the appropriate TMP assembly. See the following[ post]( Migrating from Legacy / Asset Store to Package Manager Releases page-4#post-3528465).

  • The Test Runner also automatically creates and uses assembly definitions when it create a test folder. The .asmdef created and contained in this test folder also need to be manually edited to add a reference to the appropriate TMP assembly. See the same post as above.

  • There appears to be issues related to project solution where the TMPro namespace or some of the scripts / class of TextMesh Pro might not be recognized in Visual Studio. If that is the case, upgrading to the latest release of Visual Studio 2017 which is currently 15.7.5 appears to resolve this issue.

Similar issues can also happen with other code editors. In all cases, please update those editors to the latest / most recent versions and it should resolve these issues.

  • The scanning process to identify which project files need to be modified to reference the new GUIDs and FileIDs used by the TMP package can be very slow. As such, I have modified the tool to allow specifying a target folder to scan. This way, you can target only the folders that you know contain TMP related stuff / references. Depending on the structure of your project, this can greatly speed up the conversion process.

Please note the project files can be converted progressively. So even if you forgot some files / folders, you can always re-run the conversion tool to target these addition files / folders.

Also note the scanning process does not modify any of the files. The modification only happens on the next step.

This improved Project Files GUID Remapping tool will be included in version 1.2.5. Until version 1.2.5 is released, I have attached the modified code file for the scanning tool, which you can download and replace from the package cache.

  • Some users may have manually re-assigned script referenced in the past. In some cases, the incorrect dll / script was re-assigned. So if it appears that some of the files that you suspect contain TMP related stuff are not getting converted which you think you might have manually re-assigned in the past, then download the replacement GUID conversion file found in [this post]( Migrating from Legacy / Asset Store to Package Manager Releases page-4#post-3535339).

  • Uncovered potential issue with Prefabs where even though a project serialization mode may be set to Force Text in the Project Settings - Editor - Asset Serialization, the prefabs might have remained serialized in Binary which would result in the GUID Remapping Tool ignoring these prefabs since they are still in binary format.

In order to make sure prefabs are handled correctly, you can open the backup of your project in the previous version of Unity (prior to undergoing the upgrade process) and switching serialization mode back to Mixed Mode and then back to Force Text which would force these prefabs to get re-serialized as text. To make sure the re-serialization worked correctly, you can open in some text editor the prefab file to see if it is indeed in text format. Once it appear the prefabs and other assets are all in Force Text mode, the process with the upgrade process as per the instruction above.

3346792–288582–TMP_PackageUtilities.cs (36.3 KB)

15 Likes

Looking forward to it :slight_smile:

What types of things can we expect from this new version?

The usual minor bug fixes with the addition of revised TMP Shaders to support the new UNITY_UI_CLIP_RECT shader keyword which on some devices can provide a noticeable performance improvement.

Also made improvements to Kerning which now provides control over the x and y offsets as well as xAdvance of the first and second glyph in the defined pair. This change will enable users to define / setup diacritical marks correctly and other glyph adjustment pairs.

The table has also been renamed “Glyph Adjustment Table” which now also features a search bar to make it easier to find / edit those adjustment pairs.

3348148--261732--upload_2018-1-9_19-13-2.png

3 Likes

I have a question that I was thinking for some time.

Would you change at some time that Text and TextMeshProUGUI inherits both from a base class? Now we can’t support Unity text and text mesh pro at the same time. Unity text will disappear at same time or they will be both available?

No major changes will be done to UI.Text.

There are no plans for major changes / improvements on the TextMesh Pro components but I do reserve the right to maybe sneak in new stuff if it will make users happy and if it doesn’t slow down or affect getting the new Text System done and released :slight_smile:

2 Likes

Fingers crossed for getting the SDF texture generation time down :wink:

Will editing SDF fonts be much more streamlined now? Kinda frustrating with the current system if you ever need to change a font, like including more characters. I never remember what all my settings are for the SDF generator :frowning:

Anyway, looking forward to it

With the Hybrid Dynamic system, that should become much easier and I have some thoughts on additional coolness that will make that easier :slight_smile:

1 Like

So just tested it in 2018.1.b3… … upgraded a project that was already in 2018… it mostly worked fine.

The import TMP essential resources step seems like no brainer, as to why that isn’t just done anyway on importing the package really if that is the only way you can use the package… I kinda missed doing it after scanning project and updating it…only to open the scene and find nothing was there :smile: …Anyway maybe Unity upgrade the entire Project Window ,make it less shit (like proper details column with file/folder size, last modified, sorting headers etc) while also adding a global like Asset folder to show package stuff (source/resources/examples) that are used in the project etc… that way we don’t need to import extra things from the package into the project kinda somewhat defeating the whole point of global packages in a way.

Also I had a custom font material left in the old TMP resource folder that got moved out of the project along with old TMP version… it seems after scanning and fixing the guuid stuff it just defaulted the material back liberation… not sure if it would have done that if I hadn’t forgotten about the custom font material I was using for everything in project before doing that??? , but the good thing was the guuid remapping tool worked again and found that one material and fixed it so it was recognized in the materials for tmp components… the bad thing is well a bunch ton of tmp components to go fix again with modified font mats…and dealing with Unity’s awful prefab system that needs everything draggin into a scene just to fix lower hierarchies, so yeh nested prefabs what a wondeful solution that could be right now…

I did get like 200 errors of this and similar… things work and run fine now and haven’t seen these errors again after clearing them…

IndexOutOfRangeException: Array index is out of range.
TMPro.TextMeshProUGUI.UpdateSDFScale (Single lossyScale) (at C:/ProgramData/Unity/cache/packages/packages.unity.com/com.unity.textmeshpro@1.0.26/Scripts/Runtime/TMPro_UGUI_Private.cs:4172)
TMPro.TextMeshProUGUI.LateUpdate () (at C:/ProgramData/Unity/cache/packages/packages.unity.com/com.unity.textmeshpro@1.0.26/Scripts/Runtime/TMPro_UGUI_Private.cs:1562)
UnassignedReferenceException: The variable m_mesh of TextMeshProUGUI has not been assigned.
You probably need to assign the m_mesh variable of the TextMeshProUGUI script in the inspector.
UnityEngine.Mesh.SetSizedArrayForChannel (InternalShaderChannel channel, InternalVertexChannelType format, Int32 dim, System.Array values, Int32 valuesCount) (at C:/buildslave/unity/build/Runtime/Export/Mesh.cs:78)
UnityEngine.Mesh.SetArrayForChannel[Vector2] (InternalShaderChannel channel, UnityEngine.Vector2[] values) (at C:/buildslave/unity/build/Runtime/Export/Mesh.cs:91)
UnityEngine.Mesh.set_uv2 (UnityEngine.Vector2[] value) (at C:/buildslave/unity/build/Runtime/Export/Mesh.cs:154)
TMPro.TextMeshProUGUI.UpdateSDFScale (Single lossyScale) (at C:/ProgramData/Unity/cache/packages/packages.unity.com/com.unity.textmeshpro@1.0.26/Scripts/Runtime/TMPro_UGUI_Private.cs:4192)
TMPro.TextMeshProUGUI.LateUpdate () (at C:/ProgramData/Unity/cache/packages/packages.unity.com/com.unity.textmeshpro@1.0.26/Scripts/Runtime/TMPro_UGUI_Private.cs:1562)
NullReferenceException: Object reference not set to an instance of an object
TMPro.MaterialReference..ctor (Int32 index, TMPro.TMP_FontAsset fontAsset, TMPro.TMP_SpriteAsset spriteAsset, UnityEngine.Material material, Single padding) (at C:/ProgramData/Unity/cache/packages/packages.unity.com/com.unity.textmeshpro@1.0.26/Scripts/Runtime/MaterialReferenceManager.cs:545)
TMPro.TextMeshProUGUI.SetArraySizes (System.Int32[] chars) (at C:/ProgramData/Unity/cache/packages/packages.unity.com/com.unity.textmeshpro@1.0.26/Scripts/Runtime/TMPro_UGUI_Private.cs:1045)
TMPro.TMP_Text.ParseInputText () (at C:/ProgramData/Unity/cache/packages/packages.unity.com/com.unity.textmeshpro@1.0.26/Scripts/Runtime/TMP_Text.cs:1696)
TMPro.TMP_Text.GetPreferredHeight () (at C:/ProgramData/Unity/cache/packages/packages.unity.com/com.unity.textmeshpro@1.0.26/Scripts/Runtime/TMP_Text.cs:3545)
TMPro.TextMeshProUGUI.CalculateLayoutInputVertical () (at C:/ProgramData/Unity/cache/packages/packages.unity.com/com.unity.textmeshpro@1.0.26/Scripts/Runtime/TextMeshProUGUI.cs:115)
UnityEngine.UI.LayoutRebuilder.<Rebuild>m__4 (UnityEngine.Component e) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Layout/LayoutRebuilder.cs:72)
UnityEngine.UI.LayoutRebuilder.PerformLayoutCalculation (UnityEngine.RectTransform rect, UnityEngine.Events.UnityAction`1 action) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Layout/LayoutRebuilder.cs:133)
UnityEngine.UI.LayoutRebuilder.PerformLayoutCalculation (UnityEngine.RectTransform rect, UnityEngine.Events.UnityAction`1 action) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Layout/LayoutRebuilder.cs:130)
UnityEngine.UI.LayoutRebuilder.PerformLayoutCalculation (UnityEngine.RectTransform rect, UnityEngine.Events.UnityAction`1 action) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Layout/LayoutRebuilder.cs:130)
UnityEngine.UI.LayoutRebuilder.PerformLayoutCalculation (UnityEngine.RectTransform rect, UnityEngine.Events.UnityAction`1 action) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Layout/LayoutRebuilder.cs:130)
UnityEngine.UI.LayoutRebuilder.PerformLayoutCalculation (UnityEngine.RectTransform rect, UnityEngine.Events.UnityAction`1 action) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Layout/LayoutRebuilder.cs:130)
UnityEngine.UI.LayoutRebuilder.Rebuild (CanvasUpdate executing) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Layout/LayoutRebuilder.cs:72)
UnityEngine.UI.CanvasUpdateRegistry.PerformUpdate () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/CanvasUpdateRegistry.cs:123)
UnityEngine.Canvas:SendWillRenderCanvases()

Last thing for now that TMP is kinda in 2018… can you start adding the presets for TextMeshPro - Toggle, TextMeshPro - Button etc. . stuff that should really be in imo.


…Was about the post the above until I just found a reason I won’t be bothering with this package… mainly I could blame Visual Studio’s garbage assembly viewer that doesn’t show much of anything…

I might have mistaken that for TMP having source code (that could be USEABLE in the project directly through packman) …and it does have source when you can find it in the package location (which is another area of package manager under development… there is not even a button in unity packman that opens the folder location of a particular selected package version content/source files) for quick and ease of access. I can’t stand dumb design that tries to simplify everything by just not having the options for things it should, comes across as lazy design imo.

To top this annoyance off if you’ve got TMP source and project to work with already… and I’ll be honest it is very useful to have (outside of minor tweaks to bits of it) because the documentation on the api stuff on functions isn’t really there, hugely beneficial just to be able to navigate to those method calls and see how they are being used and what calls them etc… (just yesterday I was trying to find the best the addlistener script stuff to use for some tmp components… and there is no manual documentation on it really (2016 manual that mainly just for editor component stuff)… and some parts of the public api doesn’t even have summary text)… so for me hugely helpful that I can navigate and find references to where that code is used in Visual Studio directly in TMP that is in the project… Now because of this package implementation and features so far… and combined with fking MS Visual Studios own practically garbage and effing useless assembly browsing viewer, (how in the hell does monodevelop have something far better and more useable built in for developers to use when working with poorly documented dll crap, and that’s not even supplied with 2018 now )…

Anyway if you navigate to a TMP method now… you’ll end up on something like this
#region Assembly com.unity.textmeshpro.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// …\Library\ScriptAssemblies\com.unity.textmeshpro.Runtime.dll
#endregion

I’d gladly take a symlink of this C:\ProgramData\Unity\cache\packages\packages.unity.com\com.unity.textmeshpro@1.0.26… into the asset folder of the project… And Unity just automate the linking of it into a project that uses that package… than how it works right now.

Because for people with source in there project folder how this works is just step backwards with absolutely no benefit and advantage imo… maybe what a minor compile time boost? sure as option to switch to when you’re done developing in those areas… not worth it … either documentation/api gets better or packman/package implementation gets better…

For me I’ll just revert the project back to how it was before… what a waste of time. Sorry this was a total fail for me. I assumed it was going to work better than it turned out… Package manager current design and implementation in Unity (and improving in other areas like project window etc as mentioned earlier to make certain packages completely fit into the editor and project workflow properly) is just shit no other words.

Sorry for rage :slight_smile: I don’t think hybrid dynamic font system is going to make up for this packman stuff right now.

Hi!

I’m working on a plugin (it’s an UI extention framework for my company) and would like to know against which dll i have to link against so i can use it inside that plugin.

So I just threw most the stuff from the com.unity.textmeshpro@1.0.26 dir into the asset TMP folder and removed the package from project, at least it works for me this way with VS, hopefully it will continue to work this with future releases of TMP from packman or it gets improved to where I don’t need to this manual copying of its files over.

Question now is where do you setup the hybrid dynamic font stuff… is that actually in this version?

And as I’m looking at generating fonts for other languages now… in the Font Creator, is there not an option for the Character Set option to be just every letter/symbol in the Font Source I’m feeding it? It maybe overkill but still I’d like to see the results of doing it that way :slight_smile:

@Stephan_B thanks for the painless upgrade process, worked fine. Even found my prefabs.

Very much looking forward to this. If it would take some time for the patch 2018 to come out, would you recommend grabbing the free version for now?

Is the TextMes Pro folder going to stay in our Assets folder or is it going to be moved into hidden PackageManager cache folder?

The “TextMesh Pro” folder in the local project contains the Essential Resources needed by TMP and Examples & Extras (if you elected to add those).

Since these resources could be modified by users and likely to be included in builds, they are placed in the local project to make them visible to users.

Does the tool remove all the obsolete Text Container components?

The tool simply converts the old GUIDs and FileIDs to the new set of GUIDs and FileID.

It does not remove or alter any of the objects / components.

Hey I tried the upgrade tool right now, and it’s complaining about not having “Visible Meta Files” on version control.

I use collaborate and the “Version Control” option is greyed out for me. It does show Hidden Meta Files as selected, but I think it’s bogus, since collaborate uses visible meta files anyway (and I do have .meta files all over my project), but I think that’s what’s tripping up the tool.

(EDIT: Also, is the tool supposed to take HOURS, or is there something wrong? (the project is big-ish))

Oh, the leftover text containers spam into the log that they are obsolete. I’ve got tonnes of them buried everywhere in my prefabs. What would be the easiest way to remove them all?

I’ll double check the visible meta requirement. I use Collaborate as well and did not have that issue.

In terms of the process time, it should not be that long. Perhaps this meta thing is confusing the tool.

When I get home, I can tell you what file to edit to get around the meta part.