public void Open() { // Check if we don't have a colorpicker window already open if (instance == null) { // Open new colorpicker window instance = PopupWindow.Open(container, transform as RectTransform, windowPrefab); ColorPicker picker = instance.GetComponentInChildren<ColorPicker>(); // Set picker's color to ours picker.CurrentColor = GetComponent<Image>().color; // Set method to execute when color changes picker.OnColorChanged.AddListener(OnColorChanged); } // bring this colorpicker window to front instance.transform.SetAsLastSibling(); }