More questions as I dive into the world of Unity textures!
So, I have a block of code like this:
texture = hitObject.renderer.material.mainTexture as Texture2D;
// hitObject.renderer.material.mainTexture = texture;
int y = 0;
while (y < texture.height / 2) {
int x = 0;
while (x < texture.width / 2) {
Color color = new Color(0f,0f,0f,0f);
texture.SetPixel(x, y, color);
++x;
}
++y;
}
texture.Apply();
}
Nothing fancy- I go out, grab the texture and make a quarter of it transparent. The problem is that it actually modifies the texture file itself, the actually imported asset. How can I modify JUST the texture on the CURRENT object and not the actual asset?