Home > Mobile >  How to fix InveDisplayInventory.cs(37,50): error CS0246: The type or namespace name 'TextMeshPr
How to fix InveDisplayInventory.cs(37,50): error CS0246: The type or namespace name 'TextMeshPr

Time:02-01

I am trying to use TextMeshProUGUI in my code , But I am getting this error : Assets-Scriptable Objects\Inventory\DisplayInventory.cs(37,50): error CS0246: The type or namespace name 'TextMeshProUGUI' could not be found (are you missing a using directive or an assembly reference?) Wich I am using using UnityEngine.UI;. My code :

 _slot.Key.GetComponentInChildren<TextMeshProUGUI>().text = _slot.Value.amount == 1 ? "" : _slot.Value.amount.ToString("n0");

CodePudding user response:

Add using TMPro; since TextMeshProUGUI is defined in that namespace.

  •  Tags:  
  • Related