public void DrawUI(Rect rect, TextCustomizationManager textManager, Action <TextureFont> openCharTable)
        {
            // GUI.Box(rect, string.Empty);
            GUI.BeginGroup(rect);
            // copy
            if (GUI.Button(new Rect(220, 3, 25, 23), ProceduralObjectsMod.Icons[15]))
            {
                ProceduralObjectsLogic.PlaySound();
                textManager.copiedField = TextField.Clone(this, false);
            }
            if (m_type == 0)
            {
                if (!m_font.m_disableColorOverwriting)
                {
                    painter = GUIPainter.DrawPainterSampleOnly(painter, new Vector2(3, 4), m_fontColor,
                                                               (c) => { m_fontColor = c; },
                                                               () =>
                    {
                        if (textManager.colorPickerSelected == painter)
                        {
                            textManager.colorPickerSelected = null;
                        }
                        else
                        {
                            textManager.colorPickerSelected = painter;
                        }
                    });
                }
                GUI.SetNextControlName("TextFieldPOTextCustom");
                m_text = GUI.TextField(new Rect(m_font.m_disableColorOverwriting ? 3 : 31, 3, m_font.m_disableColorOverwriting ? 214 : 186, 25), m_text);
            }
            else // if m_type == 1
            {
                painter = GUIPainter.DrawPainterSampleOnly(painter, new Vector2(3, 4), m_fontColor,
                                                           (c) => { m_fontColor = c.KeepAlphaFrom(m_fontColor); },
                                                           () =>
                {
                    if (textManager.colorPickerSelected == painter)
                    {
                        textManager.colorPickerSelected = null;
                    }
                    else
                    {
                        textManager.colorPickerSelected = painter;
                    }
                });
                GUI.Label(new Rect(30, 5, 190, 23), LocalizationManager.instance.current["colorRect"]);
            }


            GUIUtils.DrawSeparator(new Vector2(3, 75), 241);

            if (m_type == 0) // TEXT FIELD
            {
                //size
                GUI.Label(new Rect(3, 80, 95, 22), "<size=12>" + LocalizationManager.instance.current["font_size"] + " : " + m_fontSize.ToString() + "</size>");
                m_fontSize = (uint)Mathf.FloorToInt(GUI.HorizontalSlider(new Rect(100, 85, 140, 25), m_fontSize, 5, 150));

                //spacing
                GUI.Label(new Rect(3, 105, 95, 22), "<size=12>" + LocalizationManager.instance.current["font_spacing"] + " : " + m_spacing.ToString() + "</size>");
                m_spacing = (uint)Mathf.FloorToInt(GUI.HorizontalSlider(new Rect(100, 110, 140, 25), m_spacing, 0, 9));

                //scale
                GUI.Label(new Rect(3, 130, 120, 26), LocalizationManager.instance.current["scale_txt"] + " :");
                if (GUI.Button(new Rect(3, 155, 24, 26), "X :", GUI.skin.label))
                {
                    m_scaleX = 1f;
                }
                m_scaleX = GUI.HorizontalSlider(new Rect(30, 158, 90, 18), m_scaleX, 0.1f, 5f);
                if (GUI.Button(new Rect(125, 155, 24, 26), "Y :", GUI.skin.label))
                {
                    m_scaleY = 1f;
                }
                m_scaleY = GUI.HorizontalSlider(new Rect(150, 158, 90, 18), m_scaleY, 0.1f, 5f);

                //font
                bool supportStyles = m_font.m_boldExists && m_font.m_italicExists;
                if (GUI.Button(new Rect(3, 180, (supportStyles ? 126 : 213), 25), m_fontName))
                {
                    ProceduralObjectsLogic.PlaySound();
                    openCharTable.Invoke(m_font);
                }
                if (GUI.Button(new Rect((supportStyles ? 128 : 215), 180, 26, 25), "▼"))
                {
                    ProceduralObjectsLogic.PlaySound();
                    // SetFont(textManager.fontManager.GetNextFont(m_font));
                    scrollFontsPos      = Vector2.zero;
                    expandFontsSelector = !expandFontsSelector;
                }
                if (supportStyles)
                {
                    string[] styles = new string[] { LocalizationManager.instance.current["textStyle_normal"], "<b>" + LocalizationManager.instance.current["textStyle_bold"] + "</b>", "<i>" + LocalizationManager.instance.current["textStyle_italic"] + "</i>" };
                    if (m_font.m_stylesNames != null)
                    {
                        if (m_font.m_stylesNames.Length == 3)
                        {
                            styles = m_font.m_stylesNames;
                        }
                    }
                    m_style = TextCustomizationManager.IntToStyle(GUI.Toolbar(new Rect(158, 180, 85, 25), TextCustomizationManager.SelectedStyle(m_style), styles));
                }
                if (expandFontsSelector)
                {
                    TextureFont fontSelected;
                    if (FontManager.instance.FontSelector(new Rect(3, 207, 240, 160), scrollFontsPos, out fontSelected, out scrollFontsPos))
                    {
                        SetFont(fontSelected);
                        expandFontsSelector = false;
                        scrollFontsPos      = Vector2.zero;
                    }
                }
            }
            else if (m_type == 1) // COLOR RECT
            {
                GUI.Label(new Rect(4, 80, 100, 22), "<size=12>" + LocalizationManager.instance.current["colorRect_width"] + " :</size>");
                //   m_width = (uint)Mathf.FloorToInt(GUI.HorizontalSlider(new Rect(4, 44, 200, 25), m_width, 1, 2048));
                if (widthField == null)
                {
                    widthField = new GUIUtils.FloatInputField(m_width);
                }
                m_width = (uint)widthField.DrawField(new Rect(74, 79, 170, 35), m_width, false, 0f, 1024f, true, Mathf.Abs(Mathf.Round(textManager.windowTex.width - x))).returnValue;

                GUI.Label(new Rect(4, 115, 100, 22), "<size=12>" + LocalizationManager.instance.current["colorRect_height"] + " :</size>");
                if (heightField == null)
                {
                    heightField = new GUIUtils.FloatInputField(m_height);
                }
                m_height = (uint)heightField.DrawField(new Rect(74, 117, 170, 35), m_height, false, 0f, 1024f, true, Mathf.Abs(Mathf.Round(textManager.windowTex.height - y))).returnValue;

                GUI.Label(new Rect(4, 154, 200, 22), "<size=12>" + LocalizationManager.instance.current["colorRect_opacity"] + " : " + ((int)(m_fontColor.a * 100)).ToString() + "%</size>");
                m_fontColor.a = GUI.HorizontalSlider(new Rect(4, 176, 200, 25), m_fontColor.a, 0f, 1f);

                if (borderColor == null)
                {
                    borderColor = Color.white;
                }
                GUI.Label(new Rect(4, 193, 200, 22), "<size=12>" + LocalizationManager.instance.current["colorRect_border"] + " : " + borderSize.ToString() + " px</size>");
                borderSize    = (uint)Mathf.RoundToInt(GUI.HorizontalSlider(new Rect(4, 215, 200, 25), borderSize, 0f, 20f));
                borderPainter = GUIPainter.DrawPainterSampleOnly(borderPainter, new Vector2(214, 198), borderColor,
                                                                 (c) => { borderColor = c; },
                                                                 () =>
                {
                    if (textManager.colorPickerSelected == borderPainter)
                    {
                        textManager.colorPickerSelected = null;
                    }
                    else
                    {
                        textManager.colorPickerSelected = borderPainter;
                    }
                });
            }

            // POSITION

            GUIUtils.DrawSeparator(new Vector2(3, 29), 241);

            GUI.Label(new Rect(3, 30, 75, 21), "<size=12>" + LocalizationManager.instance.current["position"] + " :</size>");
            //  float newX, newY;
            if (posXfield == null)
            {
                posXfield = new GUIUtils.FloatInputField(x);
                posYfield = new GUIUtils.FloatInputField(y);
            }
            GUI.Label(new Rect(3, 51, 24, 22), "<size=12>X :</size>");
            x = posXfield.DrawField(new Rect(27, 50, 83, 22), "textPosX", x, true).returnValue;
            GUI.Label(new Rect(111, 51, 24, 22), "<size=12>Y :</size>");
            y = posYfield.DrawField(new Rect(135, 50, 83, 22), "textPosY", y, true).returnValue;

            // rotation
            if (GUI.Button(new Rect(220, 50, 25, 23), ProceduralObjectsMod.Icons[5]))
            {
                ProceduralObjectsLogic.PlaySound();
                if (m_type == 0)
                {
                    if (m_rotation == 0)
                    {
                        m_rotation = 4;
                    }
                    else if (m_rotation == 4)
                    {
                        m_rotation = 1;
                    }
                    else if (m_rotation == 1)
                    {
                        m_rotation = 2;
                    }
                    else if (m_rotation == 2)
                    {
                        m_rotation = 0;
                    }
                }
                else if (m_type == 1)
                {
                    var h = m_height;
                    m_height = m_width;
                    m_width  = h;
                }
            }


            GUI.EndGroup();
        }
 public override void OnOpen(List <ProceduralObject> selection)
 {
     base.OnOpen(selection);
     value           = Gizmos.ConvertRoundToDistanceUnit(GetAvgRenderDistance(POGroup.AllObjectsInSelection(selection, logic.selectedGroup)));
     renderDistInput = new GUIUtils.FloatInputField(value);
 }