title: Whats the best way to use Building Recognition in Unity using ARFoundation?
body: <p>I have done my research, but i did not get the results that i wanted. I followed the Instructions of this video <a href="https://www.youtube.com/watch?v=I9j3MD7gS5Y" rel="nofollow noreferrer">https://www.youtube.com/watch?v=I9j3MD7gS5Y</a>.</p>
  <p>My Code of the ARTrackedImages:</p>
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using UnityEngine.XR;
  using UnityEngine.XR.ARFoundation;
  
  [RequireComponent(typeof(ARTrackedImageManager))]
  public class MultipleImageObjectRecognition : MonoBehaviour
  {
      [SerializeField]
      private GameObject[] placeablePrefabs;
  
      private Dictionary&lt;string, GameObject&gt; spawnedPrefabs = new Dictionary&lt;string, GameObject&gt;();
      private ARTrackedImageManager trackedImageManager;
  
      private void Awake()
      {
          trackedImageManager = FindObjectOfType&lt;ARTrackedImageManager&gt;();
  
          foreach(GameObject prefab in placeablePrefabs)
          {
              GameObject newPrefab = Instantiate(prefab, Vector3.zero, Quaternion.identity);
              newPrefab.name = prefab.name;
              spawnedPrefabs.Add(prefab.name, newPrefab);
          }
      }
  
      private void OnEnable(){
          trackedImageManager.trackedImagesChanged +=ImageChanged;
          Debug.Log(&quot;Added Image&quot;);
      }
  
      private void OnDisable(){
          trackedImageManager.trackedImagesChanged -=ImageChanged;
          Debug.Log(&quot;Remove Image&quot;);
      }
  
      private void ImageChanged(ARTrackedImagesChangedEventArgs eventArgs)
      {
          foreach(ARTrackedImage trackedImage in eventArgs.added)
          {
              UpdateImage(trackedImage);
              Debug.Log(&quot;added Image &quot; + trackedImage.name);
          }
          foreach(ARTrackedImage trackedImage in eventArgs.updated)
          {
              UpdateImage(trackedImage);
              Debug.Log(&quot;updated Image &quot; + trackedImage.name);
          } 
          foreach(ARTrackedImage trackedImage in eventArgs.removed)
          {
              spawnedPrefabs[trackedImage.name].SetActive(false);
              Debug.Log(&quot;removed Image &quot; + trackedImage.name);
          }
      }
  
      private void UpdateImage(ARTrackedImage trackedImage)
      {
          string name = trackedImage.referenceImage.name;
          Vector3 position = trackedImage.transform.position;
  
          GameObject prefab = spawnedPrefabs[name];
          prefab.transform.position = position;
          prefab.SetActive(true);
  
          foreach(GameObject go in spawnedPrefabs.Values)
          {
              if(go.name != name)
              {
                  go.SetActive(false);
                  Debug.Log(go.name + &quot; has been removed&quot;);
              }
          }
      }
  }
  </code></pre>
  <p>The first problem that occured, was that the Images of the Buildings I have taken, did not work with the „arcoreimg“-Tool (not enough Keypoints). So I found some random pictures, which get a Score of 70.</p>
  <p>(For the testing: I have 2 Images with a score above 70 and two GameObjects.)</p>
  <p>Secondly when the Image gets recognized by the ArApp the GameObject appears, but when i move the recognized Image, the GameObject does not Update properly. It just stays at the first recognized position. Sometimes i can switch between the two pictures and the correct Gameobject appears. But most of the time it does not work properly.
  And i am using the Lunar Console and it seems like the app ends up in an endless loop Log output:</p>
  <pre><code>updated Image ARTrackedImage 00000072E1CCDC00-600613A12A17C812
  cycle has been removed
  updated Image ARTrackedImage 00000073E674EE80-600613A12A17C812
  berlin has been removed
  updated Image ARTrackedImage 00000072E1CCDC00-600613A12A17C812
  cycle has been removed
  updated Image ARTrackedImage 00000073E674EE80-600613A12A17C812
  berlin has been removed
  updated Image ARTrackedImage 00000072E1CCDC00-600613A12A17C812
  cycle has been removed
  updated Image ARTrackedImage 00000073E674EE80-600613A12A17C812
  berlin has been removed
  updated Image ARTrackedImage 00000072E1CCDC00-600613A12A17C812
  cycle has been removed
  updated Image ARTrackedImage 00000073E674EE80-600613A12A17C812
  berlin has been removed
  updated Image ARTrackedImage 00000072E1CCDC00-600613A12A17C812
  cycle has been removed
  updated Image ARTrackedImage 00000073E674EE80-600613A12A17C812
  berlin has been removed
  updated Image ARTrackedImage 00000072E1CCDC00-600613A12A17C812
  cycle has been removed
  updated Image ARTrackedImage 00000073E674EE80-600613A12A17C812
  berlin has been removed
  updated Image ARTrackedImage 00000072E1CCDC00-600613A12A17C812
  cycle has been removed
  updated Image ARTrackedImage 00000073E674EE80-600613A12A17C812
  berlin has been removed
  updated Image ARTrackedImage 00000072E1CCDC00-600613A12A17C812
  cycle has been removed
  </code></pre>
  <p>Maybe it has something to do with UpdateImage() or is there even a better/more accurate way to image recognition</p>