Skip to content

Unable to resize through code after docking a panel #23

@Rhitomaic

Description

@Rhitomaic

Description of the bug

So I tried to dock a RectTransform using code and it doesn't seem to resize properly, it's stuck at MinSize still even though I don't want it to start at MinSize,

Despite debugging making sure the Vector2 I used is correct, the panel is still resized towards it's minimum size
Image

Reproduction steps

Here's the code I'm using

using DynamicPanels;
using UnityEngine;

namespace Rhitomata {
    public class GameUI : MonoBehaviour {
        public DynamicPanelsCanvas dynamicCanvas;

        [Header("Timeline")]
        public RectTransform timelinePanel;
        public Vector2 timelineMinSize = new(200f, 100f);
        [HideInInspector] public Panel dynamicTimelinePanel;
        [HideInInspector] public PanelTab dynamicTimelinePanelTab;

        private void Awake() {
            // Timeline
            var previousTimelineSize = timelinePanel.rect.size;
            dynamicTimelinePanel = PanelUtils.CreatePanelFor(timelinePanel, dynamicCanvas);
            dynamicTimelinePanel.DockToRoot(Direction.Bottom);
            dynamicTimelinePanelTab = PanelUtils.GetAssociatedTab(timelinePanel);
            dynamicTimelinePanelTab.MinSize = timelineMinSize;
            dynamicTimelinePanelTab.Icon = null;
            dynamicTimelinePanelTab.Label = "Timeline";
            dynamicTimelinePanel.ResizeTo(previousTimelineSize);
        }
    }
}

Platform specs

Please provide the following info if this is a Unity 3D repository.

  • Unity version: 6000.0.51f1
  • Platform: Unity Editor
  • Device: Lenovo Thinkpad L15 Gen 1
  • How did you download the plugin: GitHub

Additional info
None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions