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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more..
    Dismiss Notice
  3. Dismiss Notice

How to make a statement if the input field is empty

Discussion in 'UGUI & TextMesh Pro' started by Nathan1357, Apr 28, 2021.

  1. Nathan1357

    Nathan1357

    Joined:
    Apr 14, 2021
    Posts:
    19
    Hey guys, can some one tell me how to make a if statement if the input field is empty? Thanks.
     
  2. knowourculture2019

    knowourculture2019

    Joined:
    Aug 21, 2020
    Posts:
    9
    Code (CSharp):
    1. if(string.IsNullOrEmpty(TMPyourRef.text))
    2. {
    3.      //Do What you Want
    4. }
    5.  
    Here it is.