It worked once, but in a wrong place. I changed some container size flags, and now it’s been 3 hours since all went wrong(
The problem:
I have NinePatchRect
(1) inside another NinePatchRect
(2) inside GridContainer
. I need to pass outer (2) rect’s size to the inner (1) one. Both NinePatchRect
s have textures set at runtime. As I’m working within a container the only way to get starting size would be to set an anchor for (2), otherwise the size would equal to (0, 0)
. And I can actually see the size.x
value change in the editor after assigning the anchors. BUT, once the code is executed, by the time I get to the size.x
value it becomes 0
. Even though the texture is placed and shown correctly.
NPR (2) has following size flags:
Horizontal
Fill Expand
Vertical
Fill
NPR (1) is set to layout_mode
POSITION
at the position of NPR (2). If I use any anchors, I won’t be able to change the size of the rect (which I need to do dynamically).
I actually have a RichTextLabel
(of the same size I could use) nearby within the same GridContainer
, and I can’t get it’s size value as well, as it turns to (0, 0)
.
Question:
How do I get the size of GridContainer
‘s child?