To erase parts of the image, I looped through all the pixels that were going to be erased and changed their color to clear with this nested for loop:
for (int x = relativePos.x-7; x <= relativePos.x+7; x++)
{
for (int y = relativePos.y - 7; y <= relativePos.y + 7; y++)
{
erasingTexture.SetPixel(x,y,Color.clear);
}
}
erasingTexture.Apply();
Here, relativePos is a Vector2Int that stores the position of the player on the render texture, and erasingTexture is the Texture2D that is being erased. It was pretty simple actually, although it’s probably not the fastest way of doing it.