Question by
Leonardo_610 · May 30, 2017 at 02:56 PM ·
texture2ddrawingsetpixels
Changing dinamically a texture
I would like to erase the texture from an object using another object when they are in contact. I have used SetPixel, but it doesn't work.
This is the code:
private void OnCollisionEnter(Collision col)
{
if (col.gameObject.name == "Eraser")
{
foreach (ContactPoint cp in col.contacts)
{
boardTexture.SetPixel((int)cp.point.x, (int)cp.point.y, Color.white);
}
}
}
It has no errors, but it doesn't work. Thanks for the help.
Comment