flutter-unity-view-widget
flutter-unity-view-widget copied to clipboard
How to structure the app to prevent duliplicated instances with router
Hi. I'm new to Flutter. And I wonder what is the recommended way to structure an app with the router and UnityWidget working simultaneously?
My goal is to have a single UnityWidget always fixed in the background, no matter how the router and overlay UI change. But currently, a new instance of UnityWidget will be created on router update and events such as onUnityMessage is duplicated.
I tried moving UnityWidget outside the router, but touch input on Unity won't work as it's also outside of the Scaffold.
Here is a simplified structure of my current app.
MaterialApp
└ Router
└ Scaffold
└ Stack
├ UnityWidget
└ (other UI)
Thanks!