(サンプルコード)
using UnityEngine;
public class MatertialChange : MonoBehaviour
{
public Material[] matBox;
private int num = 0;
void Update()
{
if(Input.GetKeyDown(KeyCode.Space))
{
num = (num + 1) % matBox.Length;
this.gameObject.GetComponent().material = matBox[num];
}
}
}
(設定)
(実行結果)