Search Unity

Question TMPro check

Discussion in 'Scripting' started by HenryCzok_, Nov 27, 2022.

Thread Status:
Not open for further replies.
  1. HenryCzok_

    HenryCzok_

    Joined:
    Oct 29, 2022
    Posts:
    3
    Can i check if is something written in tmpro text with script
    i try to use this but this wont work

    Code (CSharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5. using TMPro;
    6.  
    7. public class Codes : MonoBehaviour
    8. {
    9.     [SerializeField] TextMeshProUGUI CodeText;
    10.     public GameObject JE2012Info;
    11.  
    12.     void Update()
    13.     {
    14.         if (CodeText.text == "JE2012")
    15.         {
    16.             JE2012Info.SetActive(true);
    17.         }
    18.     }
    19. }
    20.  
     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,040
    What do you mean with 'tmpro text'?
     
  3. HenryCzok_

    HenryCzok_

    Joined:
    Oct 29, 2022
    Posts:
    3
    Text from Text Mesh Pro
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,674
    What does this mean?

    How to report your problem productively in the Unity3D forums:

    http://plbm.com/?p=220

    This is the bare minimum of information to report:

    - what you want
    - what you tried
    - what you expected to happen
    - what actually happened, especially any errors you see
    - links to documentation you used to cross-check your work (CRITICAL!!!)
     
  5. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,040
    What kurt says. Text from textmesh pro, is just a string
     
  6. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,423
Thread Status:
Not open for further replies.