public void ColorPresets(Color color) { SliderInteractactable(false); cMC = GetComponentInParent <ColorMenuControl>(); float r = color.r; float g = color.g; float b = color.b; var colors = button.colors; colors.normalColor = color; colors.highlightedColor = color; colors.pressedColor = color; cMC.ChangeColor(cTypeName, r, g, b); button.colors = colors; rSlide.value = button.colors.normalColor.r; gSlide.value = button.colors.normalColor.g; bSlide.value = button.colors.normalColor.b; float rT = rSlide.value * 255;//Muiltiplies 0 to 1 float so display shows 0 to 255 float gT = gSlide.value * 255; float bT = bSlide.value * 255; rText.text = rT.ToString("000"); gText.text = gT.ToString("000"); bText.text = bT.ToString("000"); SliderInteractactable(true); }
void ColorSliders(float r, float g, float b) { cMC = GetComponentInParent <ColorMenuControl>(); rText = rSlide.transform.Find("Value").GetComponent <Text>(); gText = gSlide.transform.Find("Value").GetComponent <Text>(); bText = bSlide.transform.Find("Value").GetComponent <Text>(); var colors = button.colors; colors.normalColor = new Color(r, g, b, 1f); colors.highlightedColor = colors.normalColor; colors.pressedColor = colors.normalColor; float rT = r * 255;//Muiltiplies 0 to 1 float so display shows 0 to 255 float gT = g * 255; float bT = b * 255; rText.text = rT.ToString("000"); gText.text = gT.ToString("000"); bText.text = bT.ToString("000"); cMC.ChangeColor(cTypeName, r, g, b); button.colors = colors; }