Hello.
I have a Panel containing a scrolling list. I am attempting to anchor its clipping region to be between two other UI objects. We'll call them TopBar and BottomBar, they are UISprites.
However, the Panel, TopBar, and BottomBar are all part of different prefabs and are arranged at runtime. I have tried setting Panel's anchor targets and relative offsets in code. However, while the anchor values change the clipping values do not. Only by altering the values manually via the inspector causes the clipping plane to move.
The code looks like this:
UIPanel panel = this.GetComponent<UIPanel>();
Debug.Log("Resizing Panel");
panel.bottomAnchor.target = BottomBarBackground.transform;
panel.bottomAnchor.Set(1,0);
panel.topAnchor.target = TopBar.transform;
panel.topAnchor.Set(0, 1);
panel.RebuildAllDrawCalls();
I feel as though there is some command I am missing to make the clipping area re-size itself based on the new anchor values.
Currently, when I run this code the Panel's clipping area stats do not change, staying at prefab values.