I've been trying to create a simple UI using CUI. I use the following code to create UI:
CuiElementContainer elements = new CuiElementContainer();
elements.Add(new CuiElement
{
Name = "Button1",
Parent = "Overlay",
Components =
{
new CuiButtonComponent
{
Close = "Button1",
Color = "0 0 0",
Command = "command",
},
new CuiRectTransformComponent
{
AnchorMin = "0.729 0.031",
AnchorMax = "0.752 0.072",
OffsetMax = "0 0"
}
}
});
elements.Add(new CuiElement {
Name = "Button1Text",
Parent = "Button1",
Components =
{
new CuiRectTransformComponent
{
AnchorMin = "0.729 0.031",
AnchorMax = "0.752 0.072",
OffsetMax = "0 0"
},
new CuiTextComponent
{
Text = "<",
Align = TextAnchor.MiddleCenter,
FontSize = 14,
Color = "1 1 1",
}
}
});
elements.Add(new CuiElement
{
Name = "Button2",
Parent = "Overlay",
Components =
{
new CuiButtonComponent
{
Close = "Button2",
Color = "0 0 0",
Command = "command"
},
new CuiRectTransformComponent
{
AnchorMin = "0.775 0.031",
AnchorMax = "0.798 0.072",
OffsetMax = "0 0"
}
}
});
elements.Add(new CuiElement
{
Name = "Button2Text",
Parent = "Button2",
Components =
{
new CuiRectTransformComponent
{
AnchorMin = "0.775 0.031",
AnchorMax = "0.798 0.072",
OffsetMax = "0 0"
},
new CuiTextComponent
{
Text = ">",
Align = TextAnchor.MiddleCenter,
FontSize = 14,
Color = "1 1 1",
}
}
});
CuiHelper.AddUi(player, elements);The buttons disappear when clicked but neither of them calls the command. The command is registered via [ChatCommand("command")]. Everything is a part of RustPlugin. Why doesn't it work?