Reputation: 99
I use objImporter it is not problem created unity but i import created 3dmax it is problem
사용한 스크립트 https://wiki.unity3d.com/index.php/ObjImporter
This error occured
Mesh.vertices is too large. A mesh may not have more than 65000 vertices.
UnityEngine.Mesh:set_vertices(Vector3[])
ObjImporter:ImportFile(String) (at Assets/MyAssets/Scripts/ObjImporter.cs:52)
UIManager:Load() (at Assets/MyAssets/Scripts/UIManager.cs:50)
UnityEngine.EventSystems.EventSystem:Update()
Mesh.uv is out of bounds. The supplied array needs to be the same size as the Mesh.vertices array.
UnityEngine.Mesh:set_uv(Vector2[])
ObjImporter:ImportFile(String) (at Assets/MyAssets/Scripts/ObjImporter.cs:53)
UIManager:Load() (at Assets/MyAssets/Scripts/UIManager.cs:50)
UnityEngine.EventSystems.EventSystem:Update()
Mesh.normals is out of bounds. The supplied array needs to be the same size as the Mesh.vertices array.
UnityEngine.Mesh:set_normals(Vector3[])
ObjImporter:ImportFile(String) (at Assets/MyAssets/Scripts/ObjImporter.cs:54)
UIManager:Load() (at Assets/MyAssets/Scripts/UIManager.cs:50)
UnityEngine.EventSystems.EventSystem:Update()
Failed setting triangles. Some indices are referencing out of bounds vertices. IndexCount: 166833, VertexCount: 0
UnityEngine.Mesh:set_triangles(Int32[])
ObjImporter:ImportFile(String) (at Assets/MyAssets/Scripts/ObjImporter.cs:55)
UIManager:Load() (at Assets/MyAssets/Scripts/UIManager.cs:50)
UnityEngine.EventSystems.EventSystem:Update()
Upvotes: 0
Views: 306
Reputation: 530
I believe that your problem related to the model size, because the mesh may have more than 65000 vertices. you should read each chunk of 65000 vertices and put them in a mesh peice then collect all the mesh pieces in one mesh which is the sharedmesh,
i highly recommend use this asset Simple .OBJ, it will save your time
Upvotes: 0
Reputation: 1268
The problem is that the script uses meshes with 16 bit indices, which only support models up to the size of 2^16 vertices. Unity however supports 32 bit indices which supports up to 2^32 vertices = ~4 billion. All you should need to do is add this line:
mesh.indexFormat = Rendering.IndexFormat.UInt32;
After this:
Mesh mesh = new Mesh();
Inside the function ImportFile
.
Note that some mobile devices do not support 32 bit indices.
https://docs.unity3d.com/ScriptReference/Mesh-indexFormat.html
Upvotes: 1