- Home /
just add different texture to terrain at given terrain x and y
Hello, I am making a game where i generate the levels. currently everything is based on modifying the array, and then instantiating a prefabs according to array, for example:
1011111 1011111 1000011 1000111 1000011 1111111
this is my array, and then i spawn a wall where 1 is, and i no not spawn anything where the 0's are. and it works. now i would like to paint terrain with ground texture just where 0's are (i need to do this, because 1's are rock-walls and terrain under them has rock texture, which simulates wall and i save up on resources by not having many gameobjects.. i have gone through many questions like this but i seem not to understand how to do this, all the answers are either obsolete, not working or depending on terrain heights (my terrain is flat). is there a simple way to paint a texture on terrain through script, just like i'd do this through paint texture in inspector? i do not need any advanced functions, i just need a line of code which paints loaded texture on terrain in given spot on terrain.