1. Hey, so I've been trying to get a ui working for my plugin, but I can wrap my head around how the system works. This is what I've been able to piece together from what I've figured out in RustCui.cs and looking through the forums.

    Code:
            CuiElementContainer mainUi = new CuiElementContainer();
           
            [ChatCommand("guion")]
            private void GuiOnCommand(BasePlayer player, string command, string[] args)
            {
                CuiHelper.AddUi (player, mainUi);
            }        [ChatCommand("guioff")]
            private void GuiOffCommand(BasePlayer player, string command, string[] args)
            {
                CuiHelper.DestroyUi (player, mainUi.ToString());
            }        void OnServerInitialized ()
            {
                CuiButton button = new CuiButton ();            button.RectTransform.AnchorMin = "0.5 0.5";
                button.RectTransform.AnchorMax = "1.0 1.0";
                button.Button.Command = "kill";            mainUi.Add (button, "HUD/Overlay");
            }
    The button is created and shown on the players screen when you do /guion, but when you use guioff nothing seems to happen.

    Also, reading through the forums I heard talk about a bug involving the names of elements, is that still out there? If so could someone explain it and let me know of any workarounds?

    Thanks!
     
  2. Add UI panel, attach button to panel and try

    // remove ToString() method
     
    Last edited by a moderator: Oct 28, 2015
  3. I switched the button to a panel but it still does the same thing :(
     
  4. You don't have the correct args to the DestroyUi function.
    CuiHelper.DestroyUi (player, panelName);
     
  5. Thanks!