CinemachineInputProvider and OnScreenControl.SendValueToControl() method

Hello

I use the following system

UnityProject: 2021.3.24f1
Cinemachine: 2.8.9
Input System: 1.5.1

What we want to implement

・Move the character with the 1st finger pressed.(Completed)
・Move the camera with the second finger pressed.(Incomplete)

Current setting

  1. Set Right Stick [GamePad] to control camera with Input Actions.
  2. Attached CinemachineInputProvider to Virtual Camera and attached Input Action set in 1 to XY Axis.
  3. Create and use a script that extends OnScreenControl. The script is shown at the bottom of this page.

This issue

OnScreenControl.SendValueToControl() method does not work with CinemachineInputProvider.

OnScreenControl.SendValueToControl() method cannot control the camera, but if I set it to control the character temporarily, I can control the character successfully, so it is definitely a CinemachineInputProvider issue This is certainly a problem with the CinemachineInputProvider.

Describe the script for 3.
It sends the second finger movement as a camera operation with the SendValueToControl() method.

using UnityEngine.InputSystem.EnhancedTouch;
using Touch = UnityEngine.InputSystem.EnhancedTouch.Touch;
using TouchPhase = UnityEngine.InputSystem.TouchPhase;
using UnityEngine;
using System.Collections.Generic;
using System;
using UnityEngine.UI;
using UnityEngine.InputSystem.OnScreen;
using UnityEngine.InputSystem.Layouts;

public class Test : OnScreenControl
{
    private int touchId = -1;
    private int targetFingerIndex = 1;
    private Dictionary<TouchPhase, Action<Touch>> touchFunctions;

    [SerializeField] private float deathPoint = 0.1f;
    [SerializeField] private Graphic joystickBackGround;
    [SerializeField] private Graphic joyStickbutton;
    [InputControl(layout = "Stick"), SerializeField] private string m_ControlPath = "<Gamepad>/rightStick";

    private Vector2 deltaDrag;
    private Vector2 axisValue;

    public Vector2 AxisValue
    {
        get => this.axisValue;
        private set
        {
            MonoBehaviour.print(this.axisValue);
            this.axisValue = value;
            this.SendValueToControl(this.AxisValue);
        }
    }

    protected override string controlPathInternal
    {
        get => this.m_ControlPath;
        set => this.m_ControlPath = value;
    }
  
    private void Awake()
    {
        EnhancedTouchSupport.Enable();

        this.touchFunctions = new Dictionary<TouchPhase, Action<Touch>>()
        {
            {TouchPhase.Began, this.OnDrag},
            {TouchPhase.Moved, this.OnDrag},
            {TouchPhase.Stationary, this.OnStationary},
            {TouchPhase.Canceled, this.OnPointerUp},
            {TouchPhase.Ended, this.OnPointerUp},
        };
    }
  
    private void Update()
    {
        this.GetTouch();
        this.InvokeFunction();
    }

    private void GetTouch()
    {
        if (this.touchId != -1) return;
        if (Touch.activeTouches.Count <= this.targetFingerIndex) return;

        this.touchId = Touch.activeTouches[this.targetFingerIndex].touchId;
    }

    private void InvokeFunction()
    {
        if (this.touchId == -1) return;
      
        for (int i = 0; i < Touch.activeTouches.Count; i++)
        {
            var targetTouch = Touch.activeTouches[i];
            if (targetTouch.touchId != this.touchId) continue;

            this.touchFunctions[targetTouch.phase].Invoke(targetTouch);
        }
    }
  
    public void OnDrag(Touch touch)
    {
        Vector2 targetAxis = Vector2.zero;

        if (RectTransformUtility.ScreenPointToLocalPointInRectangle(this.joystickBackGround.rectTransform, touch.screenPosition, null, out Vector2 pos))
        {
            this.joyStickbutton.rectTransform.anchoredPosition = pos;
            var relative = pos - this.deltaDrag;

            targetAxis = new Vector3(
                relative.x * Screen.width * 0.001f,
                relative.y * 0.001f * Screen.height
            );
            this.deltaDrag = pos;
        }

        if (targetAxis.magnitude <= this.deathPoint)
        {
            this.AxisValue = Vector2.zero;
        }
        else
        {
            this.AxisValue = targetAxis;
        }
    }

    private void OnStationary(Touch touch)
    {
        this.AxisValue = Vector2.zero;
    }

    public void OnPointerUp(Touch _)
    {
        this.deltaDrag = this.AxisValue = Vector2.zero;
        this.touchId = -1;
    }
}

I’ve been told that Touch #1/Delta might work if you move it with the second finger, but I can’t use it because the other condition is that the UI is tapped.

Can you put together a test project that shows this issue and send it to me?