/// <summary>
        /// Sets the palette.
        /// </summary>
        /// <param name="value">Value.</param>
        protected virtual void SetPalette(Image value)
        {
            if (dragListener != null)
            {
                dragListener.OnDragEvent.RemoveListener(OnDrag);
            }

            palette = value;
            if (palette != null)
            {
                paletteRect = palette.transform as RectTransform;

                dragListener = Utilites.GetOrAddComponent <DragListener>(palette);
                dragListener.OnDragEvent.AddListener(OnDrag);

                clickListener = Utilites.GetOrAddComponent <ClickListener>(palette);
                clickListener.ClickEvent.AddListener(OnDrag);

                UpdateMaterial();
            }
            else
            {
                paletteRect = null;
            }
        }
        /// <summary>
        /// Sets the palette.
        /// </summary>
        /// <param name="value">Value.</param>
        protected virtual void SetImage(Image value)
        {
            if (dragListener != null)
            {
                dragListener.OnDragEvent.RemoveListener(OnDrag);
            }

            image = value;
            if (image != null)
            {
                imageRect = image.transform as RectTransform;

                dragListener = Utilites.GetOrAddComponent <DragListener>(image);
                dragListener.OnDragEvent.AddListener(OnDrag);

                clickListener = Utilites.GetOrAddComponent <ClickListener>(image);
                clickListener.ClickEvent.AddListener(OnDrag);
            }
            else
            {
                imageRect = null;
            }
        }
 /// <summary>
 /// This function is called when the object becomes enabled and active.
 /// </summary>
 protected virtual void OnDestroy()
 {
     dragListener = null;
 }