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

Parámetros

hueMinHue mínimo [0..1].
hueMaxHue máximo [0..1].
saturationMinSaturación mínima [0..1].
saturationMaxMaximum saturation [0..1].
valueMinValor mínimo [0..1].
valueMaxValor máximo [0..1].
alphaMinAlpha mínimo [0..1].
alphaMaxAlpha máximo [0..1].

Valor de retorno

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.

Descripción

Genera un color aleatorio de rangos HSV y alpha.

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); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961