Instrument Android composition input for native diagnosis
This commit is contained in:
@@ -33,6 +33,8 @@ namespace MagnetismHeroes.UnityRuntime.Interaction
|
||||
private float _pinchDistance;
|
||||
private int _fingerId = -1;
|
||||
private bool _waitForAllTouchesReleased;
|
||||
private int _diagnosticEvents;
|
||||
private bool _diagnosticReady;
|
||||
private int _pinchFirstId = -1, _pinchSecondId = -1;
|
||||
private readonly struct TouchContact
|
||||
{
|
||||
@@ -162,6 +164,7 @@ namespace MagnetismHeroes.UnityRuntime.Interaction
|
||||
|
||||
private void RecordTouch(Finger finger)
|
||||
{
|
||||
if (AcceptInput && _diagnosticEvents++ < 16) Debug.Log($"[CompositionInput] callback {finger.lastTouch.phase} screen={finger.screen?.name} current={Touchscreen.current?.name} gesture={_gesture}");
|
||||
if (!AcceptInput || finger.screen != Touchscreen.current) return;
|
||||
// Copy each official history callback before later events overwrite the native touch slot.
|
||||
var touch = finger.lastTouch;
|
||||
@@ -228,6 +231,7 @@ namespace MagnetismHeroes.UnityRuntime.Interaction
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (AcceptInput && !_diagnosticReady) { _diagnosticReady = true; Debug.Log($"[CompositionInput] ready enabled={enabled} touchscreen={Touchscreen.current?.name} enhanced={EnhancedTouchSupport.enabled}"); }
|
||||
if (!AcceptInput) { _touchEvents.Clear(); _touches.Clear(); return; }
|
||||
bool hadTouches = _touchEvents.Count > 0, suppressRestOfFrame = false;
|
||||
while (_touchEvents.Count > 0)
|
||||
@@ -255,6 +259,7 @@ namespace MagnetismHeroes.UnityRuntime.Interaction
|
||||
}
|
||||
private void OnEnable()
|
||||
{
|
||||
Debug.Log("[CompositionInput] subscribing");
|
||||
EnhancedTouchSupport.Enable();
|
||||
UnityEngine.InputSystem.EnhancedTouch.Touch.onFingerDown += RecordTouch;
|
||||
UnityEngine.InputSystem.EnhancedTouch.Touch.onFingerMove += RecordTouch;
|
||||
|
||||
Reference in New Issue
Block a user