- Home /
Keep 2D tiles generating when player reaches edge of tiles already generated
void Generate() {
for (int i = 0; i < 20; i++) {
for(int j = 0; j < 20; j++) {
clone = Instantiate(grid,new Vector2(i*tileWidth, j*tileHeight),Quaternion.identity)as GameObject;
clone.renderer.material = tiles[Random.Range(0,tiles.Length)];
}
}
}
I have a grid generating and I make the material random. How do I keep that grid going when I get to the edge of what is already generated? Also, another small question is it possible to change material at runtime?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613064018im_/https://answers.unity.com/themes/thub/images/avi.jpg)