I'm just starting on Unity. I'm trying to develop a "game" that I need to change the walls textures on runtime. So in the game I have a bunch of cubes (walls) ant the I have on my assets folder the textures and the materials that have those textures mapped.
I need to, when the user presses a key it changes the textures of a wall.
I have tried rendered.material.mainTexture = Resources.Load("path/to/texture"). And some variations of this.
I have tried also to define a shader the apply the shader to the material, like
var shader = ...;
renderer.material = new Material(shader);
With this I was able to change the look of the wall on runtime but I cant load the texture to that shader.
But with no success, so I would need the change the texture on runtime and the tile(x,y).
Thanks for the help