This question was
closed Dec 04, 2016 at 03:30 PM by
brenolimaa96 for the following reason:
Idiot question
Question by
brenolimaa96 · Dec 04, 2016 at 03:26 PM ·
uibuttoncolorbyte
Cannot convert `float' expression to type `byte'. Simple Code
I'm receiving this error, i want to change a collor from a button, not sure if i'm doing it right, but i guess i'm in the way, why cant i use 255 or any int in alpha color?
public Button[] btns;
int randomNumber;
void Start () {
randomNumber= Random.Range(0,3);
}
void Update () {
}
void clickButton()
{
btns[randomNumber].colors.normalColor = new Color32(btns[randomNumber].colors.normalColor.r, btns[randomNumber].colors.normalColor.g, btns[randomNumber].colors.normalColor.b, 255);
}
by the way i'm getting this error also. `UnityEngine.UI.Selectable.colors'. Consider storing the value in a temporary variable, i cant understand how i should use a temporary variable in this situation
Comment
Could you be a little more careful about the context of "idiot"? The word isn't a problem, but it looked at first like you closed someone else's question and insulted them. Thanks, and thanks for cleaning it up when you answered it.