• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by DocMcShot · Jul 12, 2018 at 11:00 PM · uitextfont

Did the Text Mesh Pro namespace change?

I updated a project to 2018.2 and when I did, I got the duplicate Text Mesh Pro errors that everyone has been asking about. I followed the instructions and it fixed that problem. I'm now experiencing a problem with the references I had in script to the TextMeshProUGUI components. My "using TMPro;" directive says it's not necessary and shows as an error. All I want to do is be able to modify the TextMeshProUGUI components via script. Did something change? Any help is appreciated.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

4 Replies

· Add your reply
  • Sort: 
avatar image
5

Answer by Skelly1983 · Jul 13, 2018 at 04:07 PM

The namespace is correct.

for instance to change the text all you would need is the following:

 using TMPro;
 using UnityEngine;
 
 public class ClassName : MonoBehaviour
 {
     private TextMeshProUGUI textMeshProUGUI;
 
     private void Start()
     {
         textMeshProUGUI = GetComponent<TextMeshProUGUI>();
         
         textMeshProUGUI.text = "New text";
     }
 }


Hope this helps.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
4

Answer by DocMcShot · Jul 17, 2018 at 12:30 AM

So I solved my own problem. I went to the TextMesh Pro option window in the editor (Window->TeshMesh Pro), and imported the "TMP Examples and Extras." I had already imported the Essentials, but apparently, there's something missing from essentials that stops Visual Studio from recognizing the namespace. Anyway, I didn't include the example scenes on my import and it still worked. Hope this helps other. I'm sure it will get fixed eventually :).

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by insominx · Feb 19, 2020 at 12:30 AM

Another reason this might not work is if the assembly you're working in does not reference the TextMeshPro one. The image below shows what a valid reference might look like:

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Petrit24 · Apr 16, 2020 at 06:41 PM 1
Share

Where is this screenshot from? Like where can I find this

avatar image
1

Answer by hernan-cl · May 26, 2020 at 01:06 AM

This solution worked for me: https://forum.unity.com/threads/namespace-tmpro-not-found-in-test-runner-test.541387/#post-3570214 Pasting here: The step that I missed which is causing the issue is related to the use of an Assembly Definition in this created test folder.

The solution is to manually edit the .asmdef to add a reference to the Unity.TextMeshPro assembly.

In order to do so, select the file and use the context menu "Show in Explorer" and then open the file in some text editor to make the following changes..

 {
     "name": "Tests",
     "references": [ "Unity.TextMeshPro" ],
     "optionalUnityReferences": [ "TestAssemblies" ]
 }
  
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

211 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

UTF-8 UI Text problem 1 Answer

Text font and bold tag issue 0 Answers

TextMeshPro Set Alpha Color 0 Answers

How To Load TTF Font From External File 0 Answers

UI Text rich formatting broken after upgrading to 5.2 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges