I'm working on some custom containers ported from my unity UI, and I was wondering if there's a way to make the objects in the editor update like the non-custom ones.
I read the docs here and this got me 90% of the way there, but it's really all I can find about custom containers.
https://docs.godotengine.org/en/stable/tutorials/ui/gui_containers.html#creating-custom-containers
Here's my first test, and while this works at runtime the code won't execute in the editor so I have to keep running the UI scene to test if it worked. Is there something I have to do to make it.
using Godot;
public partial class FitterTest : Container
{
[Export(PropertyHint.Range, "0.0, 0.5")] float margin;
public override void _Notification(int what)
{
if (what == NotificationSortChildren)
{
var anchorPosition = new Vector2(margin, margin);
var anchorEnd = new Vector2(1.0f, 1.0f) - new Vector2(margin, margin);
foreach (Control c in GetChildren())
{
c.SetAnchorAndOffset(Side.Left, anchorPosition.X, 0);
c.SetAnchorAndOffset(Side.Right, anchorEnd.X, 0);
c.SetAnchorAndOffset(Side.Top, anchorPosition.Y, 0);
c.SetAnchorAndOffset(Side.Bottom, anchorEnd.Y, 0);
}
}
}
public void SetSomeSetting()
{
QueueSort();
}
}
I do recognize that there is a margin container already, but the final container code is going to be much more involved, I just want to know if there's a solution that makes it run in the editor to speed up development time.
Any help is appreciated!
Anchors are an efficient way to handle different aspect ratios for basic multiple resolution handling in GUIs, For more complex user interfaces, they can become difficult to use. This is often the ...