Search Unity

Resolved Disable and re-enable image tracking ARKit

Discussion in 'AR' started by saifshk17, Jan 22, 2021.

  1. saifshk17

    saifshk17

    Joined:
    Dec 4, 2016
    Posts:
    488
    Is there a way to disable and re-enable tracking for images in ARKit? From the older version, this was the solution. But in the newer versions have removed UnityARSessionNativeInterface script.

    Code (CSharp):
    1.  void Start ()
    2.      {
    3.          m_session = UnityARSessionNativeInterface.GetARSessionNativeInterface();
    4.      }
    5. void AddImageAnchor(ARImageAnchor arImageAnchor)
    6.      {
    7.              //at the bottom of this function
    8.              StartCoroutine(RemoveAnchorCoroutine(arImageAnchor));
    9.        
    10.      }
    11.     IEnumerator RemoveAnchorCoroutine(ARImageAnchor anchor)
    12.      {
    13.          yield return new WaitForSeconds(3.0f);
    14.         //doesn't have to be in a coroutine, but for my uses it is
    15.          m_session.RemoveUserAnchor(anchor.identifier);
    16.      }
     
  2. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,820
    UnityARKitPlugin has been deprecated and is no longer supported.
     
    saifshk17 likes this.