Search Unity

Dynamic ARTrackedImageManager not passing through ID

Discussion in 'AR' started by jstrawnfb, Oct 8, 2019.

  1. jstrawnfb

    jstrawnfb

    Joined:
    Jun 28, 2019
    Posts:
    1
    After adding some 2D Texture image targets dynamically:
    Code (CSharp):
    1. MutableRuntimeReferenceImageLibrary runtimeLibrary = (MutableRuntimeReferenceImageLibrary)trackedImageManager.referenceLibrary;
    2. Assert.IsNotNull(runtimeLibrary);
    3. Assert.IsTrue(runtimeLibrary.IsTextureFormatSupported(texture.format));
    4. runtimeLibrary.ScheduleAddImageJob(texture, "testID1", 1f);
    It does find the target and I get a callback from trackedImagesChanged, though within that callback I can't identify it (to have different effects for different images). I could use the "testID1" I passed above, but it doesn't seem to come through anywhere.

    I tried looking at
    Code (CSharp):
    1. void OnCameraTrackedImagesChanged(ARTrackedImagesChangedEventArgs eventArgs)
    2.     {
    3.         foreach (ARTrackedImage tracked in eventArgs.added)
    4.         {
    5.             Debug.Log(tracked.trackableId); // => 5E969451F6027D59-4653242E909B38B3
    6.             Debug.Log(tracked.name); // => ARTrackedImage
    7.             Debug.Log(tracked.referenceImage.name); // => 5E969451F6027D59-4653242E909B38B3
    8.         }
    9.     }
    10.  
    Interestingly also, tracked.referenceImage.texture == null, even though tracked.pending == false. Otherwise I might be able to compare the textures.

    Is there a best practice for this?
     
  2. jhocking-bundlar

    jhocking-bundlar

    Joined:
    Nov 12, 2019
    Posts:
    24
    I've been identifying image trackers using trackedImage.referenceImage.name

    That said, I don't recall where exactly that value comes from. I think that's where "testID1" goes? It's either that or the name of the texture added.