GameObject InitDialog(string name, IButtonLister buttonLister, bool startHidden) { GameObject dialogObj = GameObject.Find("/" + name); if (dialogObj == null) { Debug.LogError("missing dialog: " + name); return(null); } print(dialogObj.name + ": " + dialogObj.activeSelf); UIDialog dialog = dialogObj.GetComponent <UIDialog>(); if (buttonLister != null && buttonLister.Buttons != null) { dialog.buttonLister = buttonLister; } if (startHidden) { dialog.HidePanel(); } return(dialogObj); }