Tooltip Rendering Twice
There is a bug where tooltips are rendered twice, once correctly while hovering over the setting and a second one in the background. I've tested multiple games and it seems game specific, although it was only reproducible with Unity 6 so far.
- Valheim (Unity 6.0.46), the second tooltip is on the left:
- Tower Factory (Unity 6.0.51), the tooltip mirrored and on the right this time:
- The Farmer Was Replaced (Unity 6.0.43): The bug did not occur
- Empty Unity 6.0.46 project: The bug did not occur
For Valheim, I added a debug log Debug.Log($"OnGUI: {Time.frameCount}"); inside void OnGUI(), with the result that OnGUI was called multiple times per frame.
Adding GUI.tooltip = string.Empty to the end of DrawTooltip() suppresses the bug, although I think that's just a workaround. My guess is that a canvas or camera setting
That's a weird one, does it also move with the cursor? Looks like something in the game is drawing a texture that wasn't properly cleared, but your observations point at imgui being called more times than expected somehow, so I don't really know. If the hacky fix works fine in older games then I don't see why it shouldn't be included. Can you make a PR for it?
Yes, it does move in relation with the cursor:
https://github.com/user-attachments/assets/60b2be26-3976-4ff2-a59f-02d53ed6b7aa
I'll do some more testing with the hacky solution on other games and then open a PR if it works good