Ramune
Ramune
CC#
Created by Ramune on 2/15/2023 in #help
❔ Select next/previous item from a list when function called
So I have a list of colors, I want to check if the current color is equal to an array item, find the position of that item in the array, then set it to the next item in the array. Basically a rainbow loop, so it returns red on first run, green on second run, blue on third run, red on fourth run
public Color GetRandomColor()
{
Color current = light.color;

List<Color> colors = new List<Color>
{
Color.red,
Color.green,
Color.blue,
};

return newColor;
}
public Color GetRandomColor()
{
Color current = light.color;

List<Color> colors = new List<Color>
{
Color.red,
Color.green,
Color.blue,
};

return newColor;
}
newColor is not yet defined but will be defined as the resulting next color in the array
13 replies