# Assign image tracking for co-localization at runtime

**URL:** <https://community.nianticspatial.com/t/assign-image-tracking-for-co-localization-at-runtime/5240>\
**Category:** I'm Stuck\
**Created:** [February 27, 2025, 1:51am UTC](https://community.nianticspatial.com/t/assign-image-tracking-for-co-localization-at-runtime/5240 "2025-02-27T01:51:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ana](https://avatars.discourse-cdn.com/v4/letter/a/a6a055/32.png) [@Ana](https://community.nianticspatial.com/u/Ana)\
**Post date:** [February 27, 2025, 1:51am UTC](https://community.nianticspatial.com/t/assign-image-tracking-for-co-localization-at-runtime/5240/1 "2025-02-27T01:51:16Z")

</div>

_Include the following details (edit as applicable):_

- **Issue category** : Multiplayer
- **Device type & OS version** : Android
- **Host machine & OS version** : Windows
- **Issue Environment** : On Device
- **ARDK version** : 3.11
- **Unity version** :2022.3.57f1

Description of the issue:

Is there a way to assign the image marker for tracking at runtime so that users can select a photo from their phone gallery and use it as the co-location anchor instead of an image that is added in the editor?

Right now I am trying with a texture and doing these modifications to the texture:

```auto
    Texture2D tImg = new Texture2D(texture.width, texture.height, TextureFormat.RGB24, false);
    tImg.SetPixels(texture.GetPixels());
    tImg.Apply();

    tartWidthPhysicalSize = physicalSize;

    // Adjust the texture settings
    tImg.filterMode = FilterMode.Bilinear;
    tImg.wrapMode = TextureWrapMode.Clamp;
    targetImage = tImg;
...

```

I then use this image to create the room

```auto
var imageTrackingOptions = ISharedSpaceTrackingOptions.CreateImageTrackingOptions(targetImage, tartWidthPhysicalSize);

```

This makes the tracking stop working, but it works with the image added on the editor

---

<div class="post-metadata">

**Author:** ![Ana](https://avatars.discourse-cdn.com/v4/letter/a/a6a055/32.png) [@Ana](https://community.nianticspatial.com/u/Ana)\
**Post date:** [February 27, 2025, 2:16am UTC](https://community.nianticspatial.com/t/assign-image-tracking-for-co-localization-at-runtime/5240/2 "2025-02-27T02:16:28Z")

</div>

Actually I found this relevant error:

2025/02/26 18:08:29.483 23581 23601 Error Unity ArgumentNullException: Value cannot be null.  
2025/02/26 18:08:29.483 23581 23601 Error Unity Parameter name: referenceImage.name  
2025/02/26 18:08:29.483 23581 23601 Error Unity at UnityEngine.XR.ARSubsystems.MutableRuntimeReferenceImageLibrary.ValidateAndThrow (Unity.Collections.NativeSlice`1[T] imageBytes, UnityEngine.Vector2Int sizeInPixels, UnityEngine.TextureFormat format, UnityEngine.XR.ARSubsystems.XRReferenceImage& referenceImage) [0x00000] in <00000000000000000000000000000000>:0 2025/02/26 18:08:29.483 23581 23601 Error Unity at UnityEngine.XR.ARSubsystems.MutableRuntimeReferenceImageLibrary.ScheduleAddImageWithValidationJob (Unity.Collections.NativeSlice`1[T] imageBytes, UnityEngine.Vector2Int sizeInPixels, UnityEngine.TextureFormat format, UnityEngine.XR.ARSubsystems.XRReferenceImage referenceImage, Unity.Jobs.JobHandle inputDeps) [0x00000] in \<00000000000000000000000000000000\>:0  
2025/02/26 18:08:29.483 23581 23601 Error Unity at UnityEngine.XR.ARFoundation.MutableRuntimeReferenceImageLibraryExtensions.ScheduleAddImageWithValidationJob (UnityEngine.XR.ARSubsystems.MutableRuntimeReferenceImageLibrary library, UnityEngine.Texture2D texture, System.String name, System.Nullable`1[T]

---

<div class="post-metadata">

**Author:** ![JoshM](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@JoshM](https://community.nianticspatial.com/u/JoshM)\
**Post date:** [February 27, 2025, 5:50pm UTC](https://community.nianticspatial.com/t/assign-image-tracking-for-co-localization-at-runtime/5240/3 "2025-02-27T17:50:25Z")

</div>

Hello, thanks for reaching out! I will have to ask around for you. What device are you testing it on, or are you testing it in the editor? In the meantime, please try seeing if [this documentation](https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@5.1/manual/features/image-tracking.html#add-new-reference-images-at-runtime) helps you. It references how to set up new images at runtime for Unity’s ARFoundation Image Tracking, which the Niantic SDK is built on top of.

---

<div class="post-metadata">

**Author:** ![Ana](https://avatars.discourse-cdn.com/v4/letter/a/a6a055/32.png) [@Ana](https://community.nianticspatial.com/u/Ana)\
**Post date:** [February 27, 2025, 6:04pm UTC](https://community.nianticspatial.com/t/assign-image-tracking-for-co-localization-at-runtime/5240/4 "2025-02-27T18:04:02Z")

</div>

Thank you Josh!

I will look at the docs you sent me.

I am building for Android. In the editor the image tracking is disabled by the shared AR upm library and it just uses floor detection…I tried modifying it and using simulation for a tracked image but that breaks the co-location part so I am currently testing on a Pixel 6 phone.

Ana M.

---

<div class="post-metadata">

**Author:** ![Maverick\_Niantic](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@Maverick\_Niantic](https://community.nianticspatial.com/u/Maverick_Niantic)\
**Post date:** [March 5, 2026, 11:45pm UTC](https://community.nianticspatial.com/t/assign-image-tracking-for-co-localization-at-runtime/5240/5 "2026-03-05T23:45:02Z")

</div>

Closed on March 5, 2026, 11:45pm UTC

Age
