Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialVincent La
3,629 PointsCode
When I go to code it has errors saying that the VRDevice is obselute and has been moved and renamed how do I fix?
1 Answer
Quinton Gordon
10,985 PointsUnity has deprecated the UnityEngine.VR namespace used in these videos. Instead of VRDevice you need to add the following namespace:
using UnityEngine.XR;
and then use XRDevice like so:
if(!XRDevice.isPresent)
The change in namespace is documented in the Unity manual here:
and the scripting API is documented here:
You do not need to have the VR namespace mentioned in the video unless you are using Unity 5.6 or lower as it has been completely depreciated and replaced by the XR namespace. Going forward keep in mind that VR development is moving at breakneck speeds so the official Unity docs are going to be your friend when stuff does not work like shown in the videos.