how to make a random generator in unity code example
Example 1: unity generate random color
//using Color
Color randomColor = new Color(
Random.Range(0f, 1f), //Red
Random.Range(0f, 1f), //Green
Random.Range(0f, 1f), //Blue
1, //Alpha (transparency)
);
//using Color32
Color32 randomColor = new Color32(
Random.Range(0, 255), //Red
Random.Range(0, 255), //Green
Random.Range(0, 255), //Blue
255, //Alpha (transparency)
);
Example 2: unity how to generate a random number
Vector3 position = new Vector3(Random.Range(-10.0f, 10.0f), 0, Random.Range(-10.0f, 10.0f));