スペースキーで、マンモンの帽子の色を変えました。
using UnityEngine; using System.Collections; public class ChangeHatColorBehavior : MonoBehaviour { public Material mat1 = null; public Material mat2 = null; public string objname = ""; // Use this for initialization void Start () { } // Update is called once per frame void Update () { GameObject obj = GameObject.Find (objname); if (Input.GetKey (KeyCode.Space)) { obj.renderer.material = mat1; } else { obj.renderer.material = mat2; } } }