static public void AddToggle(MenuCommand menuCommand) { GameObject go; using (new FactorySwapToEditor()) go = DefaultControls.CreateToggle(MenuOptions.GetStandardResources()); MenuOptions.PlaceUIElementRoot(go, menuCommand); }
static public void AddPanel(MenuCommand menuCommand) { GameObject go; using (new FactorySwapToEditor()) go = DefaultControls.CreatePanel(MenuOptions.GetStandardResources()); MenuOptions.PlaceUIElementRoot(go, menuCommand); // Panel is special, we need to ensure there's no padding after repositioning. RectTransform rect = go.GetComponent <RectTransform>(); rect.anchoredPosition = Vector2.zero; rect.sizeDelta = Vector2.zero; }