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.14k stars 521 forks source link

onAttached onDettached multiples UnityWidget #728

Open Ortes opened 1 year ago

Ortes commented 1 year ago

When multiple unity widget are built un the tree only one is really displaying something, if my understanding is correct it is the last unity widget which executed the build method. In my case this is perfectly fine but I would like to know which unity widget is currently attached to the unity player. In the end I would like to be able to initialize and dispose some Gameobject in Unity when a specific unity widget is used.

One ideal solution would be to have a onAttached and onDettached callbacks on UnityWidget.

I see a "events#onViewReattached" in FlutterUnityWidgetController called is this catchable somewhere ?

Have a nice WE

Ortes commented 1 year ago

I tried a first implementation for this here #729