How do you set the correct size for custom tooltips?

Godot Version

v4.3.stable.arch_linux

Question

I am trying to set up custom tooltips for spells in my game. I am overloading the _make_custom_tooltip(from_text: String) -> Object method and returning an instance of a PackedScene containing the tooltip node tree.

When the tooltip is added to the scene tree, the height of the PopupPanel is about 40% taller than my render resolution.

This is my scene structure alongside what the tooltip should look like, populated by dummy data.

I have tried setting the PopupPanel’s StyleBox to a StyleBoxEmpty, but that doesn’t fix the issue. Looking through the other StyleBox types I couldn’t see anything that can adjust the size.

Solved this one. The little hazard sign next to the description label should have been a bit of a hint. Because I had automatic text wrapping enabled on that label, it needs a custom minimum size. After setting one, the tooltip displayed correctly.

It is a bit weird that setting a minimum stops it from growing too large but oh well.:person_shrugging:

I’m having the same problem and it appears that depending on the number of lines wrapping the sizing is completely off. Do you mind showing how your updated layout is structured? I have the exact same problem and it just seems like even with in sizes on the wrapping labels, the engine fails to size these panels correctly. If I go back to no line wrapping everything is great.

The only change needed was to set a custom minimum size on the labels that have automatic wrapping.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.