LoadModelData.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class LoadModelData : MonoBehaviour
  5. {
  6. public List<Vector3> a;
  7. public List<int> b;
  8. public Mesh mesh;
  9. // Start is called before the first frame update
  10. void Start()
  11. {
  12. mesh = this.gameObject.GetComponent<MeshFilter>().mesh;
  13. Debug.LogError(mesh.vertices.Length);
  14. a = new List<Vector3>(mesh.vertices);
  15. string infoString = string.Empty;
  16. for (int i = 0; i < 1000; i++)
  17. {
  18. infoString += mesh.vertices[i].x +","+ mesh.vertices[i].y + ","+mesh.vertices[i].z +":";
  19. }
  20. Debug.LogError(infoString);
  21. infoString = string.Empty;
  22. Debug.LogError(mesh.uv.Length);
  23. for (int i = 0; i < 1000; i++)
  24. {
  25. infoString += mesh.uv[i].x +","+ mesh.uv[i].y+":";
  26. }
  27. Debug.LogError(infoString);
  28. infoString = string.Empty;
  29. Debug.LogError(mesh.triangles.Length);
  30. for (int i = 0; i < 1000; i++)
  31. {
  32. infoString += mesh.triangles[i] + ":";
  33. }
  34. b = new List<int>(mesh.triangles);
  35. Debug.LogError(infoString);
  36. }
  37. }