Update control node visuals instantly?

Godot Version

4.4.1

Question

I recently learnt some stuff from this video by Godotneers. I noticed the new items in the inventory only showed up when you close and re-opened the inventory. An easy solution to this would be to make opening the inventory pause the game, so you can only get new items when it’s closed, but I have another case where that won’t work.
I’m making a card game where a card’s stats are displayed in a pop-up if you hover over them (using mouse entered/exited signals). I’ve been trying to implement a sort of mouse buffer function where I set the mouse mode to ignore for a frame, then re-enable it, but that didn’t work.
I was wondering if there’s a way to solve both these issues by making a control node display new information as soon as it gets it.
Thanks for reading, any help would be greatly appreciated~

Depends on how you’ve structured your code, though by default everything in a function will happen before the next frame. If you want data to show up instantly you would only need to call a function as normal, avoid deferred or await usage.

2 Likes

My function was:

on_mouse_buffer():
mouse_filter = Control.MOUSE_FILTER_IGNORE
await get_tree().create_timer(0.01).timeout
mouse_filter = Control.MOUSE_FILTER_STOP

Are you saying I should avoid await in this situation?

Regardless, simply calling the function worked in the case of my card game. Thank you :smiling_face: