画面のメニューをスマホで指して押す
スマホを向けた所にカーソルを出し、A でその下の uGUI のボタンを押します。何人でも同時に使えます。
Add Component → PadPlay → Gyro Pointer をプレイヤーの人数分追加する
カーソルにする UI の Image を、それぞれの Reticle に入れる
下のスクリプト PhoneCursor を、Gyro Pointer と同じ GameObject に追加する
using PadPlay;
using UnityEngine;
using UnityEngine.EventSystems;
// Next to a PadPlayGyroPointer: A on the phone clicks the uGUI under the cursor.
public class PhoneCursor : MonoBehaviour
{
[SerializeField] PadPlayHost host;
[SerializeField] PadPlayGyroPointer gyro;
PadPlayScreenPointer pointer;
void Update()
{
pointer ??= new PadPlayScreenPointer(gyro.PlayerSlot);
PadPlayPad pad = host.GetPad(gyro.PlayerSlot);
bool pressing = pad != null && pad.buttonSouth.isPressed;
// pixels of Display 1, origin at the bottom left
pointer.Process(EventSystem.current, gyro.IsPointing,
gyro.GetScreenPosition(), 0, pressing);
}
void OnDisable() => pointer?.Cancel();
}スマホの上の端(カメラのある辺)を画面に向けると、カーソルが動きます。ボタンに重ねて A を押すとクリックになり、ボタンの OnClick が呼ばれます。2 台目のスマホにも同じ組を置くと、2 人が同時に別のボタンを押せます。