- Home /
Why doesnt unity find Hsb color?
So i got this code because i wanted my object change colors in in a rainbow motion. But it gives me the error "The name `HSBColor' does not exist in the current context" how can i fix that
TrailRenderer.startColor = new Color(HSBColor.ToColor(new HSBColor(Mathf.PingPong(Time.time * Speed, 1), 1, 1)));The Original code i Copied
rend.material.SetColor("_Color", HSBColor.ToColor(new HSBColor( Mathf.PingPong(Time.time * Speed, 1), 1, 1)));
how can i get my code to work?
Answer by donutLaserDev · Jul 10, 2018 at 07:43 AM
Were you meaning to use this: https://docs.unity3d.com/ScriptReference/Color.HSVToRGB.html Unity doesn't have an HSBColor class. And the error tells me that you did not create this yourself.
yes i didnt i got this code from this post: https://forum.unity.com/threads/solved-rainbow-hue-shift-over-time-c-script.351751/
Well, then you did not read the forum post carefully, cause you are missing this class: http://wiki.unity3d.com/index.php?title=HSBColor
I didnt use that post you send the link i just tried to modify the code from this other post
Your answer
Follow this Question
Related Questions
Trail Renderer's colors don't apply to material 1 Answer
Material doesn't have a color property '_Color' 4 Answers
How to use HSB color space in scripting instead of RGB? 1 Answer
Changing two different objects renderer colour 1 Answer
Trying to set trail renderer color through material is acting strange 0 Answers