I try to change text color, when the button is pressed, (added BOLD line), but it dosent work, can someone show how its done ?
public void AddText(string parent, string text, string color, string anchor, string offset, int fontSize = 12, TextAnchor align = TextAnchor.MiddleLeft, string name = null)
public void AddText(string parent, string text, string color, string anchor, string offset, int fontSize = 12, TextAnchor align = TextAnchor.MiddleLeft, string name = null)
{
name ??= CuiHelper.GetGuid();
CuiElement element = new CuiElement()
{
Name = name,
Parent = parent,
DestroyUi = name,
Components = {
ParseDimensions(anchor, offset),
new CuiTextComponent()
{
//Color = string.IsNullOrEmpty(color) ? Colors.Text : color,
Color = name.Selected ? Colors.Green : Colors.Red, //**
Text = text,
Align = align,
Font = "robotocondensed-regular.ttf",
FontSize = fontSize
}
}
};
container.Add(element);
}