Im looking for some advice/direction on how to approach this.
For example… I have a dynamic list that is populated with 4 buttons, which are created by a for loop, etc.
Which creates this list.
BUT… How do i find out what player bar(button) is being hovered over.
Does each player bar(button) gets its own id or a index. that i can check if that one is being hovered.
Thank you, Ive already tried it but i think im maybe missing something…
Is Hovered only seems to work/read off the last button that was created in the list…
But i need isHovered option on all the others… So depending on what playerbar(Button) you hover over… i will display other information.
Well your logic is only going to work for the last widget created, it just so happens the way blueprints compile that the code you have works, blueprints happen to store some values in hidden member variables and so you’re reading an old cached value for the last one created. You would need to keep a list of the widgets created and iterate over them every tick checking if IsHovered is true. Alternatively, I would recommend just moving that logic into the respective blueprint widgets you’re dynamically spawning. Have them manage their own IsHovered state and do whatever it is you want them to do when hovered.
Thank you for your reply.
I have tried moving the isHovered logic into the playersbar widget Itself.
I mustn’t be understanding correctly. or maybe explaining myself properly…
If i move the ishovered into the playerbar widget which holds the 1 button that is then dynamically added into a list which shows that button 4 times.
Im still at a loss on how i can get a unique id per button or how to figure out which 1 of the 4 buttons is being hovered. when they are created from same 1 widget
When using Ishovered inside the widget it does give me is hovered or not hovered boolean on each one., Great…
But how im i able to know what button is being hovered of the 4 that was dynamically added to the list.
Sorry for repeating myself if you already knew what i was trying to do,
just looking for some more advice.
Oh I thought your meant the rows are dynamically added, I didn’t realize the buttons are as well (Gun, Ammo…etc) right? If you’re dynamically spawning them, then they’re user widgets so you can put any variable you want on the blueprint to identify them. You can just add a string that has “GUN”, “AMMO”…etc and read that off to know which button is being hovered, do that at the same time that you’re assigning them an image. Then just check IsHovered in the tick either inside the button or inside the player row, within a loop of the buttons, and you should be able to identify them that way.
Thank you for helping me on his matter.
What i have decided is not to use my menu when explaining what im needing, because i think that maybe its confusing everything with you seeing i have rank, player name, ammo, gun. icons, because they have nothing to do with what my issue is… so here goes with clean screenshot and no clutter.
I have a widget that is the menu button, that i feed dynamically into a list by using a for loop, etc. As you can see from screenshots.
And because its created dynamically. I don’t know how i can get the ishovered state off each button within the list…
For example Buton1 is being hovered, Button2 is being hovered. So basically i need to know what button in the list is being hovered… first button, second button, third button, or fourth button. i can only get ishovered to tell me one of the buttons hovered state is active… but i need to know which button… so was hoping i could somehow check the lists index of the entries of the button widget to check if that button was being hovered.
Ok, inside DemoMenu when you create the buttons. Also add them to an Array of DemoBarItem’s, then in the DemoMenu Tick, loop over the array and call IsHovered on each element in the list, now you know which widget was hovered.