using UnityEngine; using System.Collections; public class ChangeColorMaterial: MonoBehaviour { void Update() { if (Input.GetKeyDown(KeyCode.R)) { GetComponent ().material.color = Color.red; } if (Input.GetKeyDown(KeyCode.G)) { GetComponent().material.color = Color.green; } if (Input.GetKeyDown(KeyCode.B)) { GetComponent().material.color = Color.blue; } } }