1. Code:
        #region Panel
        var panelProperties = new PanelProperties()
        {
            Name = CuiHelper.GetGuid(),
            AnchorMin = "0.172 0.806",
            AnchorMax = "0.328 0.944",
            BackgroundImgProperties = new ImageProperties()
            {
                Colour = new Color(0.35f, 0.37f, 0.49f, .55f)
            },
            CursorEnabled = true
        };
        BaseUiHelper.AddPanel(ref _supportPanel, MainPanelName, panelProperties);    #endregion    #region Labels
        _supportPanel.Add(
            new CuiLabel
            {
                Text =
                {
                    Text = "Ticket Id: ",
                    Align = TextAnchor.LowerLeft,
                    Color = "1 1 1 1",
                    FontSize = 11
                },
                RectTransform =
                {
                    AnchorMin = "0.032 0.733",
                    AnchorMax = "0.364 0.933"
                }
            }, panelProperties.Name);    _supportPanel.Add(
            new CuiLabel
            {
                Text =
                {
                    Text = "Supporter: ",
                    Align = TextAnchor.MiddleCenter,
                    Color = "1 1 1 1",
                    FontSize = 11
                },
                RectTransform =
                {
                    AnchorMin = "0.04 0.525",
                    AnchorMax = "0.192 0.708"
                }
            }, panelProperties.Name);
        #endregion
    I have the above code to create a panel with two labels which i can populate with data. Only problem is that the text in the labels is getting cut off.
    I'm using RustCui - Editor to get the anchor values. The problem seems to have something to do with anchors since changing the font size includes more characters.
    My is question is this, how do anchors relate to width, height and x, y; i'm finding anchors rather confusing. Any help is welcome.
     
  2. From memory, they're min and max for width and height.

    so using names to make it clearer :

    float LeftPoint = 0.4f;
    float RightPoint = 0.6f;
    float TopPoint = 0.1f;
    float BottomPoint = 0.9f;

    RectTransform =
    {
    AnchorMin = $"{LeftPoint} {TopPoint}",
    AnchorMax = $"{RightPoint} {BottomPoint}"
    }

    If I remember correctly, that should outline something narrow but tall.
    Might be the other way around but if you take min+max as pairs and play around, you'll figure it out. ;)
     
    Last edited by a moderator: Jul 9, 2018
  3. Thanks Steenamaroo for the reply, I'll play around with what you said in mind. I'll post the results on here for people that may be searching for this in the future.

    Kind regards,
    Sililia
     
  4. It is from LEFT/BOTTOM to RIGHT/TOP, not from left/top ...