Quantcast
Channel: Questions in topic: "dynamically"
Viewing all articles
Browse latest Browse all 152

How can I get the top right position of a dynamically sized Panel?

$
0
0
I have a Panel that's positioned in the center of my scene (horizontal and vertical). I insert Buttons at runtime into the Panel. To resize the Panel depending of its content I added a Vertical Layout Group and a Content Size Fitter onto it. This works fine, but now I want to add a close Button and try to position it at the top right corner of the panel. Any idea how I can get the position of the top right corner to position my close button accordingly? You can see the close button (X) at the bottom of the screenshot. I tried to position it like that: RectTransform menuRect = menu.GetComponent (); RectTransform closeRect = close.GetComponent (); closeRect.position = new Vector3 (closeRect.position.x, menuRect.sizeDelta.y, closeRect.position.z); ![alt text][1] [1]: /storage/temp/112006-panel-rectransform.png

Viewing all articles
Browse latest Browse all 152

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>