Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question TMPro check

Discussion in 'UGUI & TextMesh Pro' started by HenryCzok_, Nov 27, 2022.

  1. HenryCzok_

    HenryCzok_

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

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    9,795
    It being a bad practice aside (comparing strings is expensive), I think this should world. Does it give you an error?