I want to change a material color between 6 different colors. I tried many things:
using UnityEngine;
using System.Collections;
public class changecolor : MonoBehaviour
{
void Star()
{
Color.cyan = 1;
Color.red = 2;
Color.green = 3;
new Color(255, 165, 0) = 4;
Color.yellow = 5;
Color.magenta = 6;
}
void OnTriggerEnter(Collider other)
{
gameObject.renderer.material.color = Random.Range(1, 6);
}
}
↧