static void DynamicGroup() { //No need to init it double times if (moreGroup == null) { moreGroup = new TouchBar.Group("slidersGroup", 6); slider = moreGroup.AddSlider("slider", 0, 10, 3, (double value) => { Debug.Log("On Slider change [value:" + value.ToString() + "]"); }); //Close group button moreGroup.AddImageButton("close", "/Editor/UniTouchBar/Icons/close.png", "", () => { if (moreGroup != null) //Shit happens - shouldn't but in case of!. { moreGroup.Hide(); } }); //Let's add and show! TouchBar.AddGroup(moreGroup); //We can hide buttons moreGroup.OnHidden += () => { showSliderButton.Show(); }; moreGroup.OnShow += () => { showSliderButton.Hide(); }; } moreGroup.Show(); }
static void EditorApplication_Update() { if (ready == true) { if (Selection.activeGameObject != null) { gameobjectGroup.Show(); if ((Selection.activeGameObject.GetComponent <Animator> () != null) || (Selection.activeGameObject.GetComponent <Animation> () != null)) { // TouchBar.Log("ej"); if (AnimatorTouchBar.loaded) { if (AnimatorTouchBar.group.windowMask == (AnimatorTouchBar.group.windowMask | (1 << (int)TouchBar.Windows.Scene))) { AnimatorTouchBar.group.Show(); } } } else { AnimatorTouchBar.group.Hide(); } if (Selection.activeGameObject.activeSelf) { if (!tick) { enableButton.UpdateImage("/Editor/UniTouchBar/Icons/enabled.png"); tick = true; } } else { if (tick) { enableButton.UpdateImage("/Editor/UniTouchBar/Icons/disabled.png"); tick = false; } } } else { if (AnimatorTouchBar.loaded) { AnimatorTouchBar.group.Hide(); } gameobjectGroup.Hide(); } } }
//private static TouchBar.Button closeButton; static void DynamicGroup() { //No need to init it double times if (moreGroup == null) { moreGroup = new TouchBar.Group("moreGroup", 6); coolButton = moreGroup.AddTextButton("cool", "made by IMVOLUTE \ud83d\ude0e"); //You can allways add action to already created items. coolButton.onClick = () => { Application.OpenURL("https://imvolute.com"); }; //Making image button - is also easy ;) moreGroup.AddImageButton("close", "/Editor/UniTouchBar/Icons/close.png", "", () => { if (moreGroup != null) //Shit happens - shouldn't but in case of!. { moreGroup.Hide(); } }); //Let's add and show! TouchBar.AddGroup(moreGroup); moreGroup.Show(); //Wow wow - what if we hide settings? This group has to hide too! settingsGroup.OnHidden += () => { if (moreGroup != null) { moreGroup.Hide(); } }; } else { //No need to recreate - just show! moreGroup.Show(); } //Cool idea! What if we chnage more... to more? }