GUI lags on tree change
In Godot 4.0, having a large tree of
Control nodes can result in lag
whenever new control nodes are added or removed from
the tree. I'm guessing these issues are a result of
Godot's GUI layout functions taking a long time.
These issues can be addressed by:
- Reusing controls when possible instead of
creating new ones.
- It appears to be cheaper to have two
RichTextLabels that you toggle the visibility on than to change the text on it, so don't try to reuse the sameRichTextLabelfor text that changes. 1
- It appears to be cheaper to have two
- Use less controls, especially containers, whenever possible.
Other problems
The GUI can lag for a number of other reasons: