Access InstancedMesh from within component

Hi,

we’re using GPU Instancing on materials, which is working fine so far. I don’t see an option though to access the InstancedMesh or get the current object’s index from within a component, only that you’re setting __isUsingInstancing as a flag for the gameObject.

How could I access the InstancedMeshRenderer or InstanceHandle from a component attached to the object?

Thank you!

Original Post on Discord

by user 827095900392259645

Out of curiosity (will have to look into the issue), what do you want to do with the mesh?

Rotate it. Or more precisely: Update its matrix

by user 827095900392259645

why do you not just move/rotate the object position/rotation that uses instanced rendering?

@marcel :cactus: That didnt work for me. Are you updating the InstancedMesh matrix when I do that?

by user 827095900392259645

You need to call InstancingUtil.markDirty(yourObject); I think