public void Open(Dictionary <string, LogicItem> connections, bool newConnection, Action sender, UnityAction onCancel = null) { DestroyButtons(); foreach (KeyValuePair <string, LogicItem> c in connections) { DialogButton dialogButton = Instantiate(DialogButtonPrefab, content.transform).GetComponent <DialogButton>(); dialogButton.Init(c.Key, async() => await sender.SelectedConnection(c.Value), new List <InteractiveObject> { ProjectManager.Instance.GetAction(c.Value.Data.Start), ProjectManager.Instance.GetAction(c.Value.Data.End) }); } if (newConnection) { DialogButton dialogButton = Instantiate(DialogButtonPrefab, content.transform).GetComponent <DialogButton>(); dialogButton.Init("New connection", async() => await sender.SelectedConnection(null)); } OnCancelCallback = onCancel; Open(); }