<pre name="code" class="csharp">using UnityEngine;
using System.Collections;
using Assets.Game.Core.Manager;
public class CustomMesh: MonoBehaviour
{
// Use this for initialization
private MeshManager _meshManager;
private GameObject _customeCube = null;
private Mesh _cubeMesh = null;
private MeshRenderer _meshRenderer = null;
private int textureIndex = 1;
void Start()
{
DrawTraingle();
}
private void DrawTraingle()
{
_customeCube = new GameObject("Traingle");
MeshFilter meshFilter = _customeCube.AddComponent<MeshFilter>();
_cubeMesh = meshFilter.mesh;
_meshRenderer = _customeCube.AddComponent<MeshRenderer>();
Texture[] textures = new Texture[6];
Vector3[] vertexs = new Vector3[36];
Vector2[] uvs = new Vector2[36];
vertexs[0] = new Vector3(0, 0, 0);
vertexs[1] = new Vector3(0, 1, 0);
vertexs[2] = new Vector3(1, 1, 0);
vertexs[3] = new Vector3(0, 0, 0);
vertexs[4] = new Vector3(1, 1, 0);
vertexs[5] = new Vector3(1, 0, 0);
vertexs[6] = new Vector3(0, 0, 0);
vertexs[7] = new Vector3(1, 0, 0);
vertexs[8] = new Vector3(1, 0, 1);
vertexs[9] = new Vector3(0, 0, 0);
vertexs[10] = new Vector3(1, 0, 1);
vertexs[11] = new Vector3(0, 0, 1);
vertexs[12] = new
UNITY3D 自定义Mesh
最新推荐文章于 2024-03-14 23:42:42 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)