using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using TMPro; //TextBarPressure public class BarPressure : MonoBehaviour { [HideInInspector] public string textValue_=""; private (string, string) defaultValue_ = ("766 мм рт.ст", "1013 гѕ"); private TextMeshPro text_; //private Text text_; void Start() { text_ = this.GetComponent(); var txt= (textValue_ == "") ? defaultValue_.Item1 : textValue_; text_.SetText(txt); /*text_ = this.gameObject.GetComponent(); text_.text = (textValue_ == "") ? defaultValue_.Item1 : textValue_;*/ } private void OnMouseDown()//нажатие на счетчик { if(textValue_ == "") { var txt = (text_.text == defaultValue_.Item2) ? defaultValue_.Item1 : defaultValue_.Item2; text_.SetText(txt); } else { text_.SetText(textValue_); } /*if(textValue_ == "") { text_.text = (text_.text == defaultValue_.Item2) ? defaultValue_.Item1 : defaultValue_.Item2; } else { text_.text = textValue_; }*/ } }