Alan Mattano
Alan Mattano

Reputation: 880

Unity. How to use Color.RGBToHSV() in Unity c#

[Learning English] I did not find Unity examples of using RGBToHSV(). I'm trying different code combinations but I do not know how to use properly RGBToHSV(). I try to use just the function but do not work. In Unity documentation and forum there is no example. Do I need to add Color to the function first? also I try myColor = to Color.RGBToHSV(...) but is not working. How is the correct way to use RGBToHSV() function?

// Declaration
public float hue { get; set; }
float S, V;

Color.RGBToHSV (actualRGBColor, out hue, out S, out V);

But err: A property or indexer GetSetColor.hue may not be passed as ref' orout' parameter.

How to use properly Color.RGBToHSV() in Unity c# ?

Upvotes: 1

Views: 2979

Answers (1)

Viliami
Viliami

Reputation: 628

You cannot use GetSetColor.hue as the out variable.

You will have to pass in a variable instead.

float hue, S, V;
Color.RGBToHSV (actualColor, out hue, out S, out V);

Upvotes: 6

Related Questions