본문 바로가기
Unity3D/Unity & C#

1개의 Color Gradient를 구간으로 나누기

by 캬캬백곰 2022. 3. 17.
728x90
[SerializeField] Color color1;
[SerializeField] Color color2;

Color[] colors;

float smoothness = 0;

public void Function(int _length)
{
     colors = new Color[_length + 1];

     for(int i = 0; i < colors.Length; i++)
     {
           smoothness += 1f / colors.Length;
           colors[i] = Color.Lerp(color1, color2, smoothness);
     }
}

 

-참고영상
https://youtu.be/rj5wdmOY-8U

728x90
반응형