- Home /
Vr Controllers Debug Log Not Showing Up In Console
Hello, I'm New To Scripting In Unity And I Recently Got An Oculus Quest 2 Which I Decided To Make A Game With. I Started Watching Some Guys Tutorial On How To Make A Vr Game (https://www.youtube.com/watch?v=VdT0zMcggTQ&t=870s) Which Worked Perfectly Fine For The First Episode Until I Watched The 2nd One. He Scripted Some Hand Precense Script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR;
public class HandPrecense : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
List<InputDevice> devices = new List<InputDevice>();
InputDevices.GetDevices(devices);
foreach (var item in devices)
{
Debug.Log(item.name + item.characteristics);
}
}
// Update is called once per frame
void Update()
{
}
}
Which Is Supposed To Make The Controllers Show Up In The Console When Starting The Game But It Didn't. Any Help Would Be Really Appreciated :)
Did you ever find the answer to this? Was following this video as well.
Answer by rh_galaxy · Aug 18, 2021 at 08:38 PM
Using Unity 2021.1.
Don't know why you are not getting an error while compiling, but InputDevice exist in both UnityEngine and UnityEngine.XR
Try
List<UnityEngine.XR.InputDevice> devices = new List<UnityEngine.XR.InputDevice>();
UnityEngine.XR.InputDevices.GetDevices(devices);