Returns a random number between 0.0 [inclusive] and 1.0 [inclusive] (Read Only).
// Generate a random color value. function RandomColor() { // A different random value is used for each color component (if // the same is used for R, G and B, a shade of grey is produced). return new Color(Random.value, Random.value, Random.value); }
using UnityEngine; using System.Collections; public class Example : MonoBehaviour { Color RandomColor() { return new Color(Random.value, Random.value, Random.value); } }
import UnityEngine import System.Collections public class Example(MonoBehaviour): def RandomColor() as Color: return Color(Random.value, Random.value, Random.value)