Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

randomly change between 6 colors C#

$
0
0
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); } }

Viewing all articles
Browse latest Browse all 171066

Trending Articles