float val = Input.GetAxis ("Mouse ScrollWheel")*sense;
if (val == 2)
{
i++;
labels[i].material.color = Color.red;
}
the problem is that I have 4 texts,the value of i is 0,when I role the scroll wheel all the text become red not just the text in the i position in the array,its painting all the texts under the same canvas and not seperatly
how can I solve it?
The UI.Text component has its own color field for each instance, even if they share the same material. That way you don’t need to make multiple material instances and Unity can still batch your labels together.