flutter-unity-view-widget
flutter-unity-view-widget copied to clipboard
Only the first user interaction (touch) goes to Unity
Describe the bug Once Unity is loaded, only the first touch is provided to Unity. I've setup response from Unity to make sure of it.
Expected behavior I want user inputs to be received and handled by the Unity Game.
Unity (please complete the following information):
- OS: Android
- Version 2020.3.25
Smartphone (please complete the following information):
- Device: Samsung Gs7
- OS: 8.0
Additional context As you can see here, the first touch is logged, but following touches are only for Flutter.
D/ViewRootImpl@60258c9[MainActivity](18223): ViewPostIme pointer 0 D/ViewRootImpl@60258c9[MainActivity](18223): ViewPostIme pointer 1 I/Unity (18223): Touch at position : (0.0, 0.0) I/Unity (18223): InputManager:StartTouch(CallbackContext) I/Unity (18223): System.Action1:Invoke(T)
I/Unity (18223): UnityEngine.InputSystem.Utilities.DelegateHelpers:InvokeCallbacksSafe(CallbackArray1&, TValue, String, Object) I/Unity (18223): UnityEngine.InputSystem.InputActionState:CallActionListeners(Int32, InputActionMap, InputActionPhase, CallbackArray1&, String)
I/Unity (18223): UnityEngine.InputSystem.InputActionState:ChangePhaseOfActionInternal(Int32, TriggerState*, InputActionPhase, TriggerState&)
I/Unity (18223): UnityEngine.InputSystem.InputActionState:ChangePhaseOfAction(InputActionPhase, TriggerState&, InputActionPhase)
I/Unity (18223): UnityEngine.InputSystem.InputActionState:ChangePhaseOfInteraction(InputActionPhase, TriggerState&, InputActionPhase, Boolean)
I/Unity (18223): UnityEngine.InputSystem.InputActionState:ProcessInteractions(TriggerState&, Int32, Int32)
I/Unity (18223): UnityEngine.InputSystem.InputActionState:ProcessControlStateChange(Int32, Int32, Int32, Double, InputEventPtr)
I/Unity (18223): UnityEngine.InputSystem.InputManager:FireStateChangeNotifications(Int32, Double, InputEvent*)
I/Unity (18223): UnityEngine.InputSystem.Inpu
I/flutter (18223): Received message from unity: Screen Position : (0.0, 0.0, 0.3) /// World Position : (-3.0, -5.0, 0.0)
D/ViewRootImpl@60258c9MainActivity: ViewPostIme pointer 0
D/ViewRootImpl@60258c9MainActivity: ViewPostIme pointer 1
D/ViewRootImpl@60258c9MainActivity: ViewPostIme pointer 0
`
Hello, I have similar issue using new unity input system. I have tried to downgrade to old one and it worked for me.
https://docs.unity3d.com/Packages/[email protected]/manual/Touch.html
You should not use Touchscreen for polling. If you want to read out touches similar to UnityEngine.Input.touches, see EnhancedTouch. If you read out touch state from Touchscreen directly inside of the Update or FixedUpdate methods, your app will miss changes in touch state.