juicycleff / flutter-unity-view-widget

Embeddable unity game engine view for Flutter. Advance demo here https://github.com/juicycleff/flutter-unity-arkit-demo
BSD 3-Clause "New" or "Revised" License
2.09k stars 504 forks source link

Can UnityWidget() work with Hero() component? #937

Open emileswain opened 3 months ago

emileswain commented 3 months ago

I'm using UnityWidget() within a Hero(), the idea being to try and persist the Unity view across views within Flutter routes.

It works, sort of, it essentially flickers a lot. I'm wondering if anyone has done something similar and or if its possible to smoothly transition the Unity view across views without the flickering.

return Hero(
      tag: "avatarHero",
      child: Padding(
          padding: const EdgeInsets.only(bottom: 13),
          child: SizedBox(
              width: double.infinity,
              height: 300,
              child: UnityWidget(
                onUnityCreated: _onUnityCreated,
                onUnityMessage: onUnityMessage,
                onUnitySceneLoaded: onUnitySceneLoaded,
                useAndroidViewSurface: true,
                // borderRadius: const BorderRadius.all(Radius.circular(70)),
              ))));