public static Texture2D TextureCut(Texture2D tex,float ratio = 0.8f) { if (tex == null) return null; if (ratio <= 0) return tex; Color color; int width = (int)(tex.width * ratio); int height = (int)(tex.height * ratio); Texture2D newTexture = new Texture2D(width,height, TextureFormat.RGB24, false); float newWidthGap = width * ratio; float newHieghtGap = height * ratio; for (int i = 0; i < newTexture.height; i++) { for (int j = 0; j < newTexture.width; j++) { color = tex.GetPixel((int)(j * (1 / ratio)), (int)(i * (1 / ratio))); newTexture.SetPixel(j, i, color); } } return newTexture; }