How do I create array of objects of alternating color? I want to create a chain that alternates between two colors every x chain link.
This is what I want to model:

The best I could do was use the wave texture node, but then I get chain links that are half orange half black:

Of course, I could just apply the array modifier and change the texture of every x set of chain links, but I want to have the option of later varying the chain length.
Thanks!
Array modifier has a UV offset option. If you shift each instance by one in U in the modifier:

then, you can use this information in the shader:

In this example, the step value is 5.
We divide X from the UV by five, take the floor of the division then modulo it by two to alternate the colors.
So that: