# Detecting multiple ImageTargets in PlayCanvas

**URL:** <https://forum.8thwall.com/t/detecting-multiple-imagetargets-in-playcanvas/1908>\
**Category:** Technical Support\
**Tags:** image-targets, general\
**Created:** [July 1, 2024, 8:55pm UTC](https://forum.8thwall.com/t/detecting-multiple-imagetargets-in-playcanvas/1908 "2024-07-01T20:55:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jose\_burga](https://avatars.discourse-cdn.com/v4/letter/j/74df32/32.png) [@jose\_burga](https://forum.8thwall.com/u/jose_burga)\
**Post date:** [July 1, 2024, 8:55pm UTC](https://forum.8thwall.com/t/detecting-multiple-imagetargets-in-playcanvas/1908/1 "2024-07-01T20:55:08Z")

</div>

Hi there!

I have a question about how to make 8thWall detect multiple imageTargets at once. I can load multiple ImageTargets with:

```auto
xrcontroller.prototype.setImageTarget = function(_loadImageTargetSet) {
  // if worldtracking enabled, 8thwall provides 5 image targets to be tracked.
  XR8.XrController.configure({imageTargets: _loadImageTargetSet})
}

```

The \_loadImageTargetSet contains an array of differend imageTarget names i added onto the 8thWall Dashboard.

But what i dont get is that i only can check for one imageTarget at the same time with the predefined Script i got from the Template (i modified it a bit to pass a name dynamically from another script):

```auto
var namedimagetarget = pc.createScript('namedimagetarget');

namedimagetarget.attributes.add('name', {type: 'string'})

namedimagetarget.prototype.trackImageTarget =
  function(targetImageID) {
    this.name = targetImageID;
    XRExtras.PlayCanvas.trackImageTargetWithName(this);
  };

```

But how can i setup tracking of multiple imageTargets at the same time? I mean im loading several imageTargets within the XrController.configure but only can check for one image? If im calling this function it overwrites the previous string / name to track the coresponding imageTarget. Because one scene can have multiple different imageTargets all the loaded image targets should be tracked / 8thwall should recognize which one is currently tracked. Passing a name array like this.name = [name1, name2]; also doesnt work…

I took a look into the XRExtras.PlayCanvas script and it contains only the function “trackImageTargetWithName()”.

I would really need help on this one - Thx!
