mardi 31 mars 2020

I want to check if 4 Conditions are meet something should happen

i am still new to c# i am trying to write a code that would check my if condition if 4 conditions are met then something happens. Here is my codes:enter code here

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

using UnityEngine.UI;
public class NameTrans : MonoBehaviour {
    public string thename;
    public GameObject inputField;
    public GameObject textDisplay;
    public GameObject textDisplay2;

    // Use this for initialization
    public void Showname () {
        thename = inputField.GetComponent<Text>().text;
     if (thename.ToUpper().Contains("Man".ToUpper()) || thename.ToUpper().Contains("Dog".ToUpper()))
        {

            textDisplay2.SetActive(false);
            textDisplay.SetActive(true);
            textDisplay.GetComponent<Text>().text = "WOrks" ;
        }
       else
        {
            textDisplay.SetActive(false);
            textDisplay2.SetActive(true);
            textDisplay2.GetComponent<Text>().text = "Not WORK" ;
        }

            }


}


Aucun commentaire:

Enregistrer un commentaire