Hi, so I’m using generic widget buttons. For the first time opening the menu It works fine but. After I clear the children and adding the child again, the button switch opacity not working but the rest code is working fine. If I dont clear the children the new child button for switch opacity is working but the old childs is not working.
Hey, your picture is too blurry to see clearly. Can you upload a clearer photo?
The opacity not working after clear child
I see, what I meant was that the first image attached with the Blueprint code is a bit blurry and not very clear to see.
Has variable WidgetButtonSection been reset? I noticed that you are writing logic inside the event graph. Please pay attention to the initialization of global variables.
Ok its working now, thanks a lot. I empty my array buttons.
So you mean there is another best approach to do this? Can you explain more please.
I usually place logic within functions unless the functionality I need to implement requires a delay node, timeline, or asynchronous node, in which case I would put the logic in the event graph. Placing logic in functions has the advantage of ensuring that the logic is executed in sequence, and parameters within the function can be directly accessed without needing to be defined as temporary variables. Logic in the event graph is generally asynchronous because events themselves are small coroutines that are asynchronous, and sometimes you need to set parameters in events as variables, which can only be set as global variables.
If you’re asking whether there’s a better way to implement your functionality, I believe there definitely is. You don’t need to frequently create and remove components. There are many ways to achieve a function, and you should just implement it. If it turns out to be performance-intensive, you can consider refactoring it later.