Struggled some time to get the dpad values and the delta touch positions in my Unity TVOS project. Its kind of strange to set it up but it works.
In the unity scripting reference you can find this value for this
Remote.reportAbsoluteDpadValues
and my thought was to call this in Awake or Start but that was exactly my misconception.
To get it working you have to call it in update just before you read the values like this:
public Dpad DpadDir = Dpad.none; public enum Dpad { none, left, right, up, down }; void Update() { if (Input.touches[0].phase == TouchPhase.Began) { UnityEngine.Apple.TV.Remote.reportAbsoluteDpadValues = true; float padLR = Input.GetAxisRaw("Horizontal"); float padUD = Input.GetAxisRaw("Vertical"); if (Mathf.Abs(padUD) + Mathf.Abs(padLR) > 0.5f) { //filter input to not get s.th. like up and left at the same time if (Mathf.Abs(padLR) > Mathf.Abs(padUD)) { if (padLR > 0.5f) this.DpadDir = Dpad.right; else this.DpadDir = Dpad.left; } else { if (padUD > 0.5f) this.DpadDir = Dpad.up; else this.DpadDir = Dpad.down; } } Debug.Log(DpadDir); } }
Hope this helps you in your future or current projects!
CODE ON!