LineRendererSimpleFlat.cs 705 B

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using UnityEngine;
  3. public class LineRendererSimpleFlat : MonoBehaviour
  4. {
  5. private void Start()
  6. {
  7. this.m_filter = base.gameObject.AddComponent<MeshFilter>();
  8. this.m_render = base.gameObject.AddComponent<MeshRenderer>();
  9. }
  10. public void SetVertexCount(int f_nCount)
  11. {
  12. Mesh mesh = new Mesh();
  13. this.m_vVert = new Vector3[f_nCount * 2 + 2];
  14. mesh.vertices = this.m_vVert;
  15. mesh.uv = new Vector2[this.m_vVert.Length];
  16. mesh.triangles = new int[f_nCount * 2];
  17. mesh.RecalculateNormals();
  18. mesh.RecalculateBounds();
  19. this.m_filter.sharedMesh = mesh;
  20. }
  21. private void Update()
  22. {
  23. }
  24. private MeshFilter m_filter;
  25. private MeshRenderer m_render;
  26. private Vector3[] m_vVert;
  27. }