is part of a InitButton static method that I use for create button at runtime
//buttonObject is passed as out param
buttonObject = new GameObject(name);
buttonObject.AddComponent<Button>();
ColorBlock colorBlock;
//Set the button colors
colorBlock = new ColorBlock();
colorBlock.normalColor = normalColor;
colorBlock.highlightedColor = highlightedColor;
colorBlock.pressedColor = pressedColor;
buttonObject.GetComponent<Button>().colors = colorBlock;
Fixed it ?
Обсуждают сегодня