void Update() { foreach (Window window in GetComponentsInChildren <Window>()) { if (window.gameObject.activeInHierarchy && !window.Taskbarbutton) { Debug.Log("Linking button!"); TaskbarButton button = CreateTaskbarButton(); LinkWindowToTaskbar(window, button); } } }
public Window CreateWindow(GameObject prefab) { GameObject windowObject = Instantiate(prefab, Screen.transform, false); Window window = windowObject.GetComponent <Window>(); TaskbarButton taskbarButton = Taskbar.AddButton(); if (window && taskbarButton) { LinkWindowToTaskbar(window, taskbarButton); return(window); } Destroy(windowObject); Taskbar.RemoveButton(taskbarButton); return(null); }
public void LinkWindowToTaskbar(Window window, TaskbarButton taskbarButton) { window.Taskbarbutton = taskbarButton; taskbarButton.Window = window; }