![](https://img.haomeiwen.com/i3711656/d434295396e7cc96.png)
![](https://img.haomeiwen.com/i3711656/974db3f01943d0da.png)
脚本如下:
using UnityEngine;
using System.Collections;
public class AgeValidation : MonoBehaviour {
private UIInput input;
// Use this for initialization
void Awake () {
input = this.GetComponent<UIInput>();
}
// Update is called once per frame
void Update () {
}
public void AgeChangeValue()
{
int ageValue = int.Parse(input.value);
if (ageValue>100)
{
input.value = "100";
}
else if (ageValue<18)
{
input.value = "18";
}
}
}
网友评论