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.13k stars 518 forks source link

Unable to click on other unity buttons after holding down the screen with your hand #850

Open iguangyu opened 1 year ago

iguangyu commented 1 year ago

Describe the bug I have encountered a situation in Unity where two fingers simultaneously touch a button and release one finger. Clicking on the screen again with the released finger will not have any response I am very confused about this. May I ask if any major figures have encountered this problem and if there is a solution I seem to have to compile the engine, but I don't know anything about it

my flutter code

image

Screenshots

image

Smartphone :

timbotimbo commented 1 year ago

This is a Flutter bug with multitouch gestures, the exact behavior that you mention happens for any PlatformView in Flutter, not just Unity. See https://github.com/flutter/flutter/issues/98188 and https://github.com/flutter/flutter/issues/96640 where this was reported in the Flutter repo. Sadly it was reported about 1.5 years ago and there doesn't seem to be anyone looking into it.

This should probably be added to the Readme as a known limitation.

Related issues: https://github.com/juicycleff/flutter-unity-view-widget/issues/556 https://github.com/juicycleff/flutter-unity-view-widget/issues/505

iguangyu commented 1 year ago

This is a Flutter bug with multitouch gestures, the exact behavior that you mention happens for any PlatformView in Flutter, not just Unity. See flutter/flutter#98188 and flutter/flutter#96640 where this was reported in the Flutter repo. Sadly it was reported about 1.5 years ago and there doesn't seem to be anyone looking into it.

This should probably be added to the Readme as a known limitation.

Related issues: #556 #505

Thank you very much for your analysis 🙏, Do you know the gestureRecognizers parameter in UnityWidget? It seems to be able to send gesture events to iOS's native uikitView

image
iguangyu commented 1 year ago

Then I tried and found that it still didn't work. I don't know if it's a problem with my own code, but it's reasonable to say that sending gesture events to iOS's native uikitView is a solution to this problem

AdrienGannerie commented 1 year ago

So the only way to get multi touch working in Unity is to remake all the inputs layer from Flutter ? How do you use gestureRecognizers from the widget ? Did you find a solution @iguangyu ?

iguangyu commented 1 year ago

So the only way to get multi touch working in Unity is to remake all the inputs layer from Flutter ? How do you use gestureRecognizers from the widget ? Did you find a solution @iguangyu ?

In the unitywidget component, the native UIKitView is already used. To solve the problem of multi touch, it is still necessary to change the flutter engine @AdrienGannerie

But I found an article that seems to have solved this problem using the change engine here -> https://zhuanlan.zhihu.com/p/429345027

AdrienGannerie commented 1 year ago

Thanks for your answer @iguangyu. I already saw this article but I don't understand anything when I try to translate it. Did you succeed to change the engine using this article ?

iguangyu commented 1 year ago

Thanks for your answer @iguangyu. I already saw this article but I don't understand anything when I try to translate it. Did you succeed to change the engine using this article ?

The content of this article is not comprehensive, only a solution is provided. I am trying to solve it with this solution, but there is currently no progress @AdrienGannerie And we can synchronize and regularly communicate progress

guilmetj commented 8 months ago

Did you manage to find any solution ?