This script, placed in the scene, allows you to touch multiple draggable objects at once, when playing on a touch-screen device.

MultiTouchDraggables.cs

using UnityEngine;

namespace AC
{

public class MultiTouchDraggables : MonoBehaviour
{

[SerializeField] private DragBase dragBase = null;


private void Update ()
{
if (dragBase.IsHeld)
{
return;
}

if (Input.touchCount < 2 || !KickStarter.stateHandler.IsInGameplay ())
{
return;
}

if (Input.GetTouch (0).phase == TouchPhase.Ended)
{
HeldObjectData heldObjectData = KickStarter.playerInput.GetHeldObjectData (dragBase);
heldObjectData.TouchIndex = 0;
}

if (Input.GetTouch (1).phase != TouchPhase.Began)
{
return;
}

Ray ray = KickStarter.CameraMain.ScreenPointToRay (Input.GetTouch (1).position);
RaycastHit hit;

if (Physics.Raycast (ray, out hit, KickStarter.settingsManager.moveableRaycastLength, 1 << LayerMask.NameToLayer (KickStarter.settingsManager.hotspotLayer)))
{
DragBase _dragBase = hit.collider.GetComponent<DragBase> ();
if (_dragBase && _dragBase == dragBase)
{
HeldObjectData[] heldObjectDatas = KickStarter.playerInput.GetHeldObjectData ();
if (heldObjectDatas != null)
{
heldObjectDatas[0].TouchIndex = 0;
}

dragBase.Grab (hit.point);
HeldObjectData heldObjectData = KickStarter.playerInput.GetHeldObjectData (dragBase);
heldObjectData.TouchIndex = 1;
}
}
}

}

}
Community content is available under CC-BY-SA unless otherwise noted.