I have a widget switcher in my UI that switches between various user widgets. In one of my user widgets, I want to know when it becomes visible (When the widget switcher makes it visible)
I’m trying to connect to the ‘On Visibility Changed Event’ like so But the ‘On Visibility Changed’ event isn’t firing.
As far as I understand it, Widget Switcher just switches widgets visibility on and off. Why isn’t this event firing?
As far as I understand it, Widget
Switcher just switches widgets
visibility on and off. Why isn’t this
event firing?
It does not change its visiblity.
Instead, you can call a custom event or use an interface when you switch. Or work in something cheeky - when you switch to a widget, read its visiblity and set it back to the very same visiblity. And the dispatcher will fire.
Both should trigger OnVisiblityChanged in the target widget that was switched to. You could send a similar message to the current widget before switching to the new one.
I’ve noticed that the ‘onTick’ event doesn’t fire on Widgets that are hidden by the WidgetSwitcher They only fire when the widget becomes visible. Can I use this to determine when a certain widget becomes viable? (IE listen to the first onTick event?)
Widgets that are not in screenspace do not tick, true; switcher tucks them away. You probably could listen for Tick → DoOnce. But then you must remember to reset it and so on. Best disable ticking in widgets anyway…
Up to you, the above works the way you wanted it to so why bother with tick.