#problem with gui_input
49 messages · Page 1 of 1 (latest)
but my upgradescreen with upgradecards are in my upgrademanager at the top of my game if you look in my 'remote'. Isn't it how higher its placed the more forward in z-index?
it is No it's the other way around, and all CanvasItems can also add z-offset. CanvalsLayers also have it set to a higher value by default if i remember correctly.
I made so the z-index is 4096(maxed) for the upgradecard and upgradescreen, but it still doesnt work.
For my upgradescreen i made all mouse_filters 'pass', and for the upgrade_cards inside the upgradeScreen i made all mouse_filters 'stop' is this ok?
as long as you don't call accept_event() inside the ones set to pass it should be fine.
do you have the VBoxContainer and Labels of the Upgrade Card set to pass/ignore?
those are also in front of the node you want to get the input from.
vbox and labels all set to 'ignore'
and it still doesn't work?
nope
try launching the ability_upgrade_card-scene on it's own (F6) and try if it works.
no, it doesn't, added a breakpoint on the on_gui_input func, and didnt get there
okay
fixed it so the scene alone works
but in full game still not working
what did you change?
I put the panelcontainer mouse input on 'stop'
panelcontainer, AbilityUpgradeCard
how are you checking if the panel got clicked?
like this, with the gui_input
so I initialised a child of abilityupgradecard inside upgrade_screen and ran the current screen upgrade_sceen, and this also worked fine.
i really don't know anymore. the last thing to try would be to use the _gui_input()-virtual Function instead.
tried that, still doesnt work.
np man, thanks for the help
will maybe just go back into my git and try to test it step by step, and checking what could be the problem
thanks mate, and for the help
what i found that could help is Viewport.gui_get_hovered_control() which returns the control node the mouse is currently inside and should be the same one that recieves the gui_input.
and then get it's NodePath with get_path() to find it in your tree.
okay, added it and when i hover over my upgrade_card i get this instead
Currently hovering over 660: MarginContainer
- Path: /root/Main/Users/User/player/PlayerUI/2D UI/MarginContainer
- Instance ID: 48922363343
so it doesnt detect my upgrade card on top
i had the feeling that it might have something to do with the CanvasLayer hidden inside your player scene.
But it's still weird since you said that your upgrade card is displayed on top.
the game looks like this
there is nothing in the middle of the screen, only the cards, so hard to tell when playing if the cards or the playerUI/2d ui is in front
well it doesn't look like it's in front, and it shouldn't be as long as the layer index is smaller.
and you said that you set it to the one for the upgrades to the limit.
yes, i put the margincontainer inside UpgradeScreen on 4096 and AbilityUpgradeCard also on 4096
that last one shouldn't be necessary, but yeah, no idea why the player ui takes the input. do you need that one to capture gui_events? Else probably disable them to be safe.
ha ha
fixed
put the mouse filter of the margincontainer inside the 2dUI on ignore
does the trick
is possible that i will need mouse input in the 2dui but that are problems for later
thanks for the help mate
glad to hear. might have something to do with having ui as a child of 3d-nodes, but that isn't really my territory and still sounds like a weird reason.