Skip to content

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.

2 participants