Skip to content

Android touch input not received/processed by Unity InputSystem #160

@PierreGerbaud

Description

@PierreGerbaud

Hello! First of all, thanks for the work on this library.

I'm trying to get a Unity view with overlaid React Native components on Android. I'm using unity 6 (6000.0.42f1); Input System UI Input Module.
Taps are properly registered by Android Logcat but don't reach Unity.

I manage to either:

  • Get a responsive full screen view in Unity, but no overlaid React items
  • Get overlaid React items and Unity player in the middle, but no input

What I tried:

  • added no-pointers to the React overlaid components
  • tinkering with the zIndex
  • confirmed all required scripts are working (the game is properly initializing with properties passed from React, and it sends messages to react)

My main hypothesis is on the ReactNative side, either:

  • some kind of zIndex conflict
  • an input focus issue
    I wouldn't think it's directly Unity related, as I manage to get the input when I drop the overlays, and the editor mode works - but i can be wrong of course.

Thanks a lot for your help!!

Image

Some possibly relevant code extracts (simplified):

AppNavigator.tsx:

{isUnityVisible && ( )} ...... const styles = StyleSheet.create({ container: { flex: 1, position: 'relative', }, unityContainer: { ...StyleSheet.absoluteFillObject, zIndex: 5, }, unityView: { flex: 1, }, navigationContainer: { ...StyleSheet.absoluteFillObject, zIndex: 10, backgroundColor: 'transparent', } });

InputManager.cs

using UnityEngine.InputSystem;
InputAction pointerAction;

void Awake() {
InputSystem.AddDevice();
pointerAction = new InputAction("PointerInteraction", binding: "/press", interactions: "Tap,MultiTap");
pointerAction.performed += HandlePointerInteraction;
}

void OnEnable() {
pointerAction?.Enable();
}

void HandlePointerInteraction(InputAction.CallbackContext context) {
Debug.Log($"[InputManager Action] Interaction '{context.interaction?.GetType().Name ?? "Press"}' Performed...");
} // this is never executed when tapping

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions