I’d like to listen to orientation change events, so for example my UI layout or the components themselves can be changed.
All I’ve found is that I should check the value of
Screen.orientation every frame, and check if it has changed since previous frame.
But this isn’t really efficient, and I wonder why doesn’t Unity provide an event for this.
This asset seems to have what I need. Anyone knows how is it implemented?
As a last resort I could make a singleton behaviour which starts a coroutine which checks every X seconds whether it has changed, and if it has, I fire an event. But this still seems like a suboptimal solution.