# How to get an instance in instancedMesh by index

**URL:** <https://discourse.threejs.org/t/how-to-get-an-instance-in-instancedmesh-by-index/32169>\
**Category:** Questions\
**Tags:** instancedmesh, materials\
**Created:** [November 28, 2021, 1:17pm UTC](https://discourse.threejs.org/t/how-to-get-an-instance-in-instancedmesh-by-index/32169 "2021-11-28T13:17:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![oat](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/oat/32/21429_2.png) [@oat](https://discourse.threejs.org/u/oat)\
**Post date:** [November 28, 2021, 1:17pm UTC](https://discourse.threejs.org/t/how-to-get-an-instance-in-instancedmesh-by-index/32169/1 "2021-11-28T13:17:57Z")

</div>

I’d like to change the **opacity** of some of some of the instances in an [instancedMesh](https://threejs.org/docs/#api/en/objects/InstancedMesh) by their indices.

Seems `instancedMeshes[i].opacity = 0.1` will throw an error:  
`Uncaught TypeError: instancedMeshes[i] is undefined`

In the official doc, there is only the method to change material color by instance index, such as: `instancedMeshes.setColorAt(i, highlightColor);`

But it’s not mentioned on how to change other properties of the material assigned to individual instances.

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [November 28, 2021, 3:27pm UTC](https://discourse.threejs.org/t/how-to-get-an-instance-in-instancedmesh-by-index/32169/2 "2021-11-28T15:27:02Z")

</div>

> [@oat](#):
>
> But it’s not mentioned on how to change other properties of the material assigned to individual instances.

You can’t assigned individual materials to instances. There is only a single material for all instances of `InstancedMesh`.
