Skip to content

Unity Touch Not Working on Android with Unity 6. #44

@GreejeshGajera

Description

@GreejeshGajera

Is there an existing issue for this?

  • I have searched the existing issues

Unity version

Unity 6000.0 LTS

Common issues

  • I have checked the common issues

Flutter version

3.29.0

Description

❌ Unity Touch Not Working on Android – Render OK but Tap Events Fail

❗️Issue Summary

Unity renders correctly on Android using flutter_embed_unity plugin v1.2.7, but touch/tap input does not work. On iOS, everything functions as expected — including touch events. The issue is Android-specific.


✅ Environment

  • Flutter version: [insert your flutter --version output]
  • Plugin version: flutter_embed_unity: 1.2.7
  • Unity version: [6000.1.7f1]
  • Android version: [e.g., Android 14]
  • Device: [e.g., Vivo V25 Pro]
  • iOS status: ✅ Working fine (render and touch)
  • Android render: ✅ Renders fine
  • Android tap: ❌ No response from Unity

🛠 What I’ve Done

  1. MainActivity extends FakeUnityPlayerActivity:

    class MainActivity : FakeUnityPlayerActivity()
  2. ✅ Added gestureRecognizers to AndroidView:

    gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>{
      Factory<OneSequenceGestureRecognizer>(() => EagerGestureRecognizer()),
    },
  3. AndroidManifest.xml includes:

    <meta-data
        android:name="io.flutter.embedding.android.AndroidViewEmbedding"
        android:value="hybrid" />
  4. ✅ Unity input code in scene:

    void Update() {
        if (Input.GetMouseButtonDown(0)) {
            Debug.Log("TOUCH DETECTED");
        }
    }
  5. ✅ Tested with both Input.GetTouch() and UI Button (OnClick) – works in Unity standalone APK

  6. ✅ No overlay widgets in Flutter, using full-size SizedBox.expand() around Unity view

  7. ✅ Ran flutter clean && flutter pub get && flutter run


🔍 What Happens

  • Unity renders properly in Flutter Android build
  • No tap or gesture events are registered by Unity
  • No logs from Debug.Log("TOUCH DETECTED") or button OnClick
  • iOS works perfectly without changes

📌 Expected Behavior

Taps on the Unity view in Android should register touch input like on iOS.


🙏 Request

Please confirm:

  • Is this a known issue with the current Android embedding?
  • Is there a workaround or fix available for handling tap/touch on Android?
  • Can we get an update or patch to address this?

I'm happy to share code samples, logs, or minimal reproduction projects if needed.

Thanks for your awesome work on this plugin!

Minimum reproducible example (MRE)

https://github.com/user-attachments/assets/01887153-4365-4409-b288-aa4a77085d67
https://github.com/user-attachments/assets/787c212a-7e96-4f5e-9f48-412d75472132

What platforms are you seeing the problem on?

Android

Devices

No response

Anything else?

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions