You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
647 B
30 lines
647 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class TextScale : MonoBehaviour
|
|
{
|
|
|
|
private Text text;
|
|
|
|
private RectTransform rectTrans;
|
|
|
|
private void OnEnable()
|
|
{
|
|
|
|
text = GetComponent<Text>();
|
|
rectTrans = transform.GetComponent<RectTransform>();
|
|
|
|
}
|
|
|
|
public void OnTextChange(string v)
|
|
{
|
|
Debug.Log(gameObject.name + text.text.Length);
|
|
text.text = ((v.Length >= 0) ? "" : "") + (v).ToString() + "";
|
|
rectTrans.sizeDelta = new Vector2( rectTrans.sizeDelta.x, text.text.Length * 1.8f);
|
|
}
|
|
|
|
|
|
}
|