private void OpenWindow(GenericWindow window, UnityAction primaryAction, UnityAction secondaryAction = null) { // Instantiate the window under the main canvas Transform canvas = GameObject.FindWithTag("MainCanvas").transform; window = Instantiate(window, canvas); // Setup the primary and secondary action of the window window.AddPrimaryAction(primaryAction); if (secondaryAction != null) { window.AddSecondaryAction(secondaryAction); } // Open the window window.Open(); }