I’m starting a new AR Foundation 6 project and making the 1st script, like I did in version 5 with other projects.
Its telling me ARSessionOrigin is deprecated and I should use XROrigin instead. However, changing to XROrigin results in a error: “not found or incorrect namespace”. Can Unity give a more descriptive error so we also know which namespace to use please
using UnityEngine;
using UnityEngine.XR.ARFoundation;
using UnityEngine.XR.ARSubsystems;
public class ARTapToPlace : MonoBehaviour
{
private XROrigin arOrigin;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
I dont get the error in VS Code, only in Unity. As far as VS Code is concerned, the code is perfectly fine, but when I save and go back to Unity, Unity gives that error. How can I find which namespace to use?
This is a sign that your VSCode isn’t configured properly to work with Unity. Microsoft maintains a plugin that will give you features like auto-imports. Notably, you need to install the Visual Studio Editor package in the Unity Editor.