i have a few images that i am using to texture some planes. The planes render perfectly fine in unity. but as soon as i build and run, they were initially all white. After some googling, i saw someone post something about materials, i changed my shader to “Legacy Shaders/Diffuse Detail” . Now i see some grey some white some brown planes instead (not the correct textures).
i am also setting the scale as:
mr.material.SetTextureScale(“_MainTex”, new Vector2(-1, 1));
images to show the issue:
from build and run:
i am not sure whats wrong. Any suggestions are welcome
Hahaha yeah, great app indeed!
But yes, unity needs a material and a mesh renderer (like it is used in the cube you created) & a Mesh filter to actually render your object. The Mesh filter has a reference to the actual mesh with its vertices etc.
The Mesh Renderer needs a reference to the material(s) you want to use.
So you have to add the created material to the mesh renderer in the corresponding gameobject .
If no renderer is present, just create one or add it to you prefab which you are instantiating.
I have the same issue after I added Built-in Shaders and then removed them from the project and Build and Run, and since that time this problem appears.
Thus I suspect a shader error instead of a simple Mesh Renderer-Material reference loss in contrary to the other suggestion here.
I had to enable the Read/Write on the sprite and it fixed it for me