static public void AddButton(MenuCommand menuCommand) { GameObject go; using (new FactorySwapToEditor()) go = DefaultControls.CreateButton(GetStandardResources()); PlaceUIElementRoot(go, menuCommand); }
static public void AddButton(MenuCommand menuCommand) { GameObject go = DefaultControls.CreateButton(GetStandardResources()); PlaceUIElementRoot(go, menuCommand); SetDefaultTxt(go); }
public static void AddButton() { GameObject rSelectGo = Selection.activeGameObject; var rResultType = AppDomain.CurrentDomain.GetAssemblies() .SingleOrDefault(rAssembly => rAssembly.GetName().Name.Equals("UnityEditor.UI"))?.GetTypes()? .SingleOrDefault(rType => rType.FullName.Equals("UnityEditor.UI.MenuOptions")); if (rResultType == null) { return; } var rStandradResources = (DefaultControls.Resources)rResultType.InvokeMember( "GetStandardResources", System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static, null, null, new object[0] ); var rGo = DefaultControls.CreateButton(rStandradResources); var rButtonGo = rResultType.InvokeMember( "PlaceUIElementRoot", System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static, null, null, new object[] { rGo, new MenuCommand(rSelectGo) }); var rButtonAssist = rGo.ReceiveComponent <ButtonAssist>(); rButtonAssist.Button = rGo.GetComponent <Button>(); rButtonAssist.AudioClipName = "click"; rButtonAssist.AudioDisableClipName = "click_invalid"; var rButtonAnim = AssetDatabase.LoadAssetAtPath <RuntimeAnimatorController>("Assets/Game/GameAsset/GUI/Animations/Button.controller"); var rAnimator = rGo.ReceiveComponent <Animator>(); rAnimator.runtimeAnimatorController = rButtonAnim; Selection.activeGameObject = rGo; }
public static void AddButton(MenuCommand menuCommand) { MenuOptions.PlaceUIElementRoot(DefaultControls.CreateButton(MenuOptions.GetStandardResources()), menuCommand); }
public static void AddButton(MenuCommand menuCommand) { GameObject element = DefaultControls.CreateButton(MenuOptions.GetStandardResources()); MenuOptions.PlaceUIElementRoot(element, menuCommand); }