1. using UnityEngine; using System.Collections;
public class ChangeColor : MonoBehaviour {
// Use this for initialization void Start () { } // Update
is called once per frame void Update () {
if (Input.GetKeyDown(KeyCode.A))
{
this.GetComponent<MeshRenderer>().material.color = Color.red;
}
if (Input.GetKeyDown(KeyCode.B))
{
this.GetComponent<MeshRenderer>().material.color = Color.yellow;
Unity中通过按键改变物体颜色
最新推荐文章于 2024-05-01 23:10:50 发布