# How to add TMPRo for my script

**URL:** https://discussions.unity.com/t/how-to-add-tmpro-for-my-script/916975
**Category:** Scripting
**Tags:** Scripting, Question
**Created:** [May 4, 2023, 10:11pm UTC](https://discussions.unity.com/t/how-to-add-tmpro-for-my-script/916975 "2023-05-04T22:11:51Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![darthcoder567](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/darthcoder567/32/548282_2.png) [@darthcoder567](https://discussions.unity.com/u/darthcoder567)
#### Post date: [May 4, 2023, 10:11pm UTC](https://discussions.unity.com/t/how-to-add-tmpro-for-my-script/916975/1 "2023-05-04T22:11:51Z")

</div>

i created a script that updates text when it has a trigger but the tutorial i was using uses normal text not textmeshpro and in the tutorial it said to drag the text under the text variable thing but i cant what do i do? code:

```csharp
using UnityEngine;
using UnityEngine.UI;

public class Itemcollect : MonoBehaviour
{
   [SerializeField] private Text coinText;

    private int coin = 0;

    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.CompareTag("Coin"))
        {
            Destroy (collision.gameObject);
            coin++;
            Debug.Log("Coin: " + coin);
            coinText.text = "coins: " + coin;
        }
    }
}

```

---

<div class="post-metadata">

### Author: ![TheDavid8](https://avatars.discourse-cdn.com/v4/letter/t/c5a1d2/32.png) [@TheDavid8](https://discussions.unity.com/u/TheDavid8)
#### Post date: [May 5, 2023, 12:13am UTC](https://discussions.unity.com/t/how-to-add-tmpro-for-my-script/916975/2 "2023-05-05T00:13:31Z")

</div>

At the top: using TMPro;

Instead of “private Text coinText”, use “private TextMeshProUGUI coinText”

I use TextMeshPro myself as well

---

<div class="post-metadata">

### Author: ![darthcoder567](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/darthcoder567/32/548282_2.png) [@darthcoder567](https://discussions.unity.com/u/darthcoder567)
#### Post date: [May 5, 2023, 10:09pm UTC](https://discussions.unity.com/t/how-to-add-tmpro-for-my-script/916975/3 "2023-05-05T22:09:56Z")

</div>

ohh ok thanks:)
