3d物体的仅Quad可用。
如果用其他3D物体,会报错
Mesh.uv is out of bounds. The supplied array needs to be the same size as the Mesh.vertices array.
...
/// <summary>
/// Sets the frame.
/// </summary>
/// <param name="frame">Frame.</param>
public void SetFrame(int frame)
{
if (this._framesCount == 1)
{
return;
}
float xUnitSize = 1.0f / this._tilesX;
float yUnitSize = 1.0f / this._tilesY;
int xIndex = frame % this._tilesX;
int yIndex = frame / this._tilesX;
yIndex = this._tilesY - yIndex - 1;
Vector2[] uv = new Vector2[] {
//正常朝向右
/*new Vector2(xIndex * xUnitSize, yIndex * yUnitSize),//左下
new Vector2(xIndex * xUnitSize, yIndex * yUnitSize) + new Vector2(xUnitSize, 0),//右下
new Vector2(xIndex * xUnitSize, yIndex * yUnitSize) + new