Mathf.Clamp

来源:互联网 发布:淘宝网店运营策划案 编辑:程序博客网 时间:2024/05/16 03:42

Clamps a value between a minimum float and maximum float value.

using UnityEngine;using System.Collections;public class ExampleClass : MonoBehaviour {    void Update() {        transform.position = new Vector3(Mathf.Clamp(Time.time, 1.0F, 3.0F), 0, 0);    }}