Godot Version
4.2.2
Question
Trying to give items in a MenuButton tooltips but am seeing unpredictable behaviour.
This function is the only one setting anything in the MenuButton:
func setup(data: Dictionary, tooltips: Dictionary = {}) -> void:
var id := 0
for dict_name: StringName in data:
get_popup().add_item(dict_name, id)
if tooltips.has(dict_name):
var index = get_popup().get_item_index(id)
get_popup().set_item_tooltip(index, tooltips[dict_name])
print(get_popup().get_item_text(index) + " = " + get_popup().get_item_tooltip(index))
id += 1
It leads to correct output that looks like this (full output is 91 lines):
HOI = Hospitality
INTS = Intelligense
JJP = JJ Palms
LMB = Lambda Logistics
LASR = Lux Optics
MCM = Magnum Component Manufacturing
MASS = Mass Dynamics
MNSF = Mc’n’Sayn Fur’ture
However, the behaviour in game is unpredictable. Tooltips change randomly and arbitrarily so much that while writing this post I got confused because I’d look at a button’s tooltip, decide to bring it up as an example, then tab back in again and its tooltip had changed.
Generally, towards the bottom of the list (91 items) it gets more and more unpredictable. In the last few 30ish items usually there’s just no tooltip. The first few usually have the correct one.
I tried calling it that function’s printing bits during runtime and the printed list is still correct, even after I check the tooltips are fucked up.
(wrong tooltips)
(no tooltip)
