设置SpriteRenderer.flipX // flipY
!!所以说要多看API文档呀!!
以前不知道怎么处理采取了代码镜像复制图片,姑且将代码放在下面以备不时之需
using UnityEngine;
public static class ImageProcessor
{
//水平翻转图片
public static Texture2D HorizontalFlipPic(Texture2D texture2d)
{
int width = texture2d.width;//得到图片的宽度.
int height = texture2d.height;//得到图片的高度
Texture2D newTexture2d = new Texture2D(width, height); ;//创建一张同等大小的空白图片
int i = 0;
while (i < width)
{
newTexture2d.SetPixels(i, 0, 1, height, texture2d.GetPixels(width - i - 1, 0, 1, height));
i++;
}
//for(int i= 0;i
// for(int j=0; j < height; j++)
// {
// newTexture2d.SetPixel(i, j, texture2d.GetPixel(width - i - 1, j));
// }
newTexture2d.Apply(