Version: 2020.2
言語: 日本語
public static Color ColorHSV ();
public static Color ColorHSV (float hueMin, float hueMax);
public static Color ColorHSV (float hueMin, float hueMax, float saturationMin, float saturationMax);
public static Color ColorHSV (float hueMin, float hueMax, float saturationMin, float saturationMax, float valueMin, float valueMax);
public static Color ColorHSV (float hueMin, float hueMax, float saturationMin, float saturationMax, float valueMin, float valueMax, float alphaMin, float alphaMax);

パラメーター

hueMin 最低色相 [0..1]
hueMax 最高色相 [0..1]
saturationMin 最低彩度 [0..1]
saturationMax Maximum saturation [0..1].
valueMin 最小値 [0..1]
valueMax 最大値 [0..1]
alphaMin 最低アルファ [0..1]
alphaMax 最高アルファ [0..1]

戻り値

Color A random color with HSV and alpha values in the (inclusive) input ranges. Values for each component are derived via linear interpolation of value.

説明

HSV で アルファ値を持つランダムな色を生成します。

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