Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Dynamic ARTrackedImageManager not passing through ID

Discussion in 'Handheld 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?