Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unity UI - Input detection is lagging behind #231

Closed
ilkercankaya opened this issue Oct 21, 2020 · 0 comments · Fixed by #245
Closed

Unity UI - Input detection is lagging behind #231

ilkercankaya opened this issue Oct 21, 2020 · 0 comments · Fixed by #245
Assignees
Labels
bug This issue refers to a bug in the plugin

Comments

@ilkercankaya
Copy link

ilkercankaya commented Oct 21, 2020

My Unity project runs in its own activity. My problem is that, it seems when my Unity project is embedded into Flutter, the input detection(drags, clicks, ptrDown, ptrUp events) on Canvas UI lags behind of Native system events by a huge margin.

Concerete example: I move my finger inside a gameobject in a Unity canvas which tracks my finger and prints a dot on screen where my current finger is. Here is an example video showing what I mean, be aware, this is not my app. I made the same app to test if there is a lag and there is a huge lag which is caused by embedding the Unity project. To prove this further, I installed my app directly with Unity to my phone and there was no lag, the dot was printing on my finger location as I dragged it. However, when I embedded my project into flutter and tested it on release mode, the dot was lagging behind by a huge margin. I also enabled developers modes "Show taps" option to see my fingers current location detected by Android system.

For anyone wondering, here is my Unity gameobject code:

// Knob is an rect containing a huge dot as an image
private void Update()
    {
       if (Input.touchCount < 1)
        {
            return;
        }

        var touch = Input.touches[0];
        Knob.position = touch.position;
    }

Tested On: Flutter Release Mode
Flutter Unity View Widget Version: ^2.0.0+2
Platform: Android
Flutter Version: 1.22.2
Unity Version: 2019.4.71f
Tested Phone: Samsung Note 10

How may I fix this issue? Input detection is lagging behind by a huge margin when touches on Canvas UI are made.

@juicycleff juicycleff added the bug This issue refers to a bug in the plugin label Oct 22, 2020
@juicycleff juicycleff self-assigned this Oct 22, 2020
@juicycleff juicycleff linked a pull request Nov 19, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue refers to a bug in the plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants