- Home /
Question by
Tofudude624 · Nov 07, 2014 at 06:57 AM ·
materialtint
Cycling through hue values
Hello. I am trying to use this script to cycle through every hue value ...but I'm not sure what to do. Is there another way to cycle through hues (or has anyone used this script before)? Thanks.
Comment
Best Answer
Answer by robertbu · Nov 07, 2014 at 11:40 AM
Not sure what you are going to be doing with the colors, and also am not sure this is the color model you want, but here is a bit of code that cycles through the hue values and applies the result to the renderer.material.color.
using UnityEngine;
using System.Collections;
public class Example : MonoBehaviour {
public Color color = Color.red;
public float time = 3.0f;
private HSBColor hsbc;
void Start() {
hsbc = HSBColor.FromColor (color);
}
void Update() {
hsbc.h = (hsbc.h + Time.deltaTime / time) % 1.0f;
renderer.material.color = HSBColor.ToColor (hsbc);
}
}
Your answer
Follow this Question
Related Questions
change tint of image 0 Answers
Adjusting hue/tint for material color? 1 Answer
Unity 2019.3.2f1 Unity Skybox Color Tint No Effect 0 Answers
Gun Barrel To Get Hot - Change _Tint 1 Answer