The following code was taken from here. How Does this Particular Line Work -
texture.SetPixel(x, y, new Color((x + 0.5f) * stepSize % 0.1f, (y + 0.5f) * stepSize % 0.1f, 0f) * 10f);
Multiplying Color with 10 and modulus with 0.1f is confusing me ?
Asked
Active
Viewed 81 times
0

Community
- 1
- 1

Sri Krishna Paritala
- 617
- 10
- 22
1 Answers
0
All he's done in that line is have the color pattern repeat itself ten times over.
By calculating the modulo with 0.1, each loop of 0 - 1 will yield ten values (0, 0.1, 0.2...)
Further, by multiplying by 10, the color stays visible, and the result is the 10 x 10 grid pattern
Just take a look at the images the author has put up

Venkat at Axiom Studios
- 2,456
- 1
- 15
- 25