using UnityEngine;

public class Colorrand : MonoBehaviour
{
    float h = 0;
    public TMPro.TMP_Text displayer;
    private MeshRenderer r;
    // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Start()
    {
        r = GetComponent<MeshRenderer>();
    }

    // Update is called once per frame
    void Update()
    {
        r.material.color = Color.HSVToRGB(h, 1, 1);
        h += 0.05f * Time.deltaTime;
        if (h > 1f) h = 0;
        if (displayer != null)
        {
            displayer.text = $"h: {h*360}";
        }
    }
}
