unity Random.ColorHSV() code example
Example 1: unity random color
// Pick a random, saturated and not-too-dark color
GetComponent<Renderer>().material.color = Random.ColorHSV(0f, 1f, 1f, 1f, 0.5f, 1f);
Example 2: unity random color
using UnityEngine;public class ColorOnClick : MonoBehaviour
{
void OnMouseDown()
{
// Pick a random, saturated and not-too-dark color
GetComponent<Renderer>().material.color = Random.ColorHSV(0f, 1f, 1f, 1f, 0.5f, 1f);
}
}