- Home /
Question by
dinnaaa · Feb 04, 2020 at 12:54 PM ·
c#unity 5javascripterroraugmented reality
The name 'TrackManager' does not exist in the current context [Unity Vuforia Ground Plane Project]
Hi, I don't know what's the fault here.
Unity sent this error message "Assets/Scripts/DeployStageOnce.cs(34,20): error CS0103: The name 'TrackManager' does not exist in the current context"
THE CODE IS BELOW:
using System; using UnityEngine; using Vuforia;
public class DeployStageOnce : MonoBehaviour { public GameObject AnchorStage; private PositionalDeviceTracker _deviceTracker; private GameObject _previousAnchor;
public void Start ()
{
if (AnchorStage == null)
{
Debug.Log("AnchorStage must be specified");
return;
}
AnchorStage.SetActive(false);
}
public void Awake()
{
VuforiaARController.Instance.RegisterVuforiaStartedCallback(OnVuforiaStarted);
}
public void OnDestroy()
{
VuforiaARController.Instance.UnregisterVuforiaStartedCallback(OnVuforiaStarted);
}
public void OnVuforiaStarted()
{
_deviceTracker = TrackManager.Instance.GetTracker<PositionalDeviceTracker>();
}
public void OnInteractiveHitTest(HitTestResult result)
{
if (result == null || AnchorStage == null)
{
Debug.LogWarning("Hit test is invalid or AnchorStage not set");
return;
}
var anchor = _deviceTracker.Tracker.CreatePlaneAnchor(Guid.NewGuid().ToString().result);
if (anchor != null)
{
AnchorStage.transform.parent = anchor.transform;
AnchorStage.transform.localPosition = Vector3.zero;
AnchorStage.transform.localRotation = Quaternion.identity;
AnchorStage.SetActive(true);
}
if (_previousAnchor != null)
{
Destroy(_previousAnchor);
}
_previousAnchor = anchor;
}
}
Comment