Skip to content

Fix android touch events for Unity 6000. #45

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

timbotimbo
Copy link
Collaborator

Description

Touch input is currently broken when using flutter_embed_unity_6000_0_android.
Both for the new and old input system and independent of different Flutter or Unity versions.

This was reported in #44.

The existing touch override had to be removed from onTouchEvent to support Unity 6000.
I moved it to dispatchTouchEvent, just like I did in the old flutter+unity plugin.

It works fine in the other plugin, but somehow I forgot to update the super. calls properly for this plugin.

  // UnityPlayerSingleton.kt  flutter_embed_unity_2022_3_android
    override fun onTouchEvent(motionEvent: MotionEvent): Boolean {
        ...
        return super.onTouchEvent(motionEvent)
    }

     // CustomFrameLayout.kt  flutter_embed_unity_6000_0_android
    override fun dispatchTouchEvent(motionEvent: MotionEvent): Boolean {       
        ...
        return super.onTouchEvent(motionEvent)  // <---- Current version.
        return super.dispatchTouchEvent(motionEvent)  // <---- Should have been this.
    }

Fix

Simply updating the super calls to dispatchTouchEvent makes touch input work again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant