用键盘控制改变实体 {MOD}彩

2019-04-13 21:56发布


using UnityEngine; using System.Collections; /** * * 作者:巨星电艺 * 编写日期:巨星电艺 **/ public class ouyChangeColor : MonoBehaviour { // Use this for initialization void Start () { } // Update is called once per frame void Update () { if(Input.GetKeyDown(KeyCode.R)) { GetComponent().material.color = Color.red; } if(Input.GetKeyDown(KeyCode.B)) { GetComponent().material.color = Color.blue; } if (Input.GetKeyDown (KeyCode.G)) { GetComponent().material.color = Color.green; } } }