Mesh.vertices is too large. A mesh may not have more than 65000 vertices

Mesh.vertices is too large. A mesh may not have more than 65000 vertices.

Hi guys, getting this error limit on large mesh with version 4.0.6 I never got this error with previous versions of pathfinding 3.x.x.

Is this a new limit?

Hi

Do you think you could post the stacktrace from that error?
It might be a bug.

I get the following 3 failures:

Mesh.vertices is too large. A mesh may not have more than 65000 vertices.
UnityEngine.Mesh:set_vertices(Vector3[])
Pathfinding.Util.Builder:DrawMesh(RetainedGizmos, Vector3[], List`1, Color[]) (at Assets/AstarPathfindingProject/Utilities/RetainedGizmos.cs:88)
Pathfinding.Util.GraphGizmoHelper:DrawTriangles(Vector3[], Color[], Int32) (at Assets/AstarPathfindingProject/Utilities/GraphGizmoHelper.cs:137)
Pathfinding.NavmeshBase:CreateNavmeshSurfaceVisualization(NavmeshTile, GraphGizmoHelper) (at Assets/AstarPathfindingProject/Generators/NavmeshBase.cs:1174)
Pathfinding.NavmeshBase:OnDrawGizmos(RetainedGizmos, Boolean) (at Assets/AstarPathfindingProject/Generators/NavmeshBase.cs:1138)
AstarPath:OnDrawGizmos() (at Assets/AstarPathfindingProject/Core/AstarPath.cs:709)
UnityEditor.DockArea:OnGUI()

Failed setting triangles. Some indices are referencing out of bounds vertices. IndexCount: 98304, VertexCount: 0
UnityEngine.Mesh:SetTriangles(List1, Int32) Pathfinding.Util.Builder:DrawMesh(RetainedGizmos, Vector3[], List1, Color[]) (at Assets/AstarPathfindingProject/Utilities/RetainedGizmos.cs:89)
Pathfinding.Util.GraphGizmoHelper:DrawTriangles(Vector3[], Color[], Int32) (at Assets/AstarPathfindingProject/Utilities/GraphGizmoHelper.cs:137)
Pathfinding.NavmeshBase:CreateNavmeshSurfaceVisualization(NavmeshTile, GraphGizmoHelper) (at Assets/AstarPathfindingProject/Generators/NavmeshBase.cs:1174)
Pathfinding.NavmeshBase:OnDrawGizmos(RetainedGizmos, Boolean) (at Assets/AstarPathfindingProject/Generators/NavmeshBase.cs:1138)
AstarPath:OnDrawGizmos() (at Assets/AstarPathfindingProject/Core/AstarPath.cs:709)
UnityEditor.DockArea:OnGUI()

Mesh.colors is out of bounds. The supplied array needs to be the same size as the Mesh.vertices array.
UnityEngine.Mesh:set_colors(Color[])
Pathfinding.Util.Builder:DrawMesh(RetainedGizmos, Vector3[], List`1, Color[]) (at Assets/AstarPathfindingProject/Utilities/RetainedGizmos.cs:90)
Pathfinding.Util.GraphGizmoHelper:DrawTriangles(Vector3[], Color[], Int32) (at Assets/AstarPathfindingProject/Utilities/GraphGizmoHelper.cs:137)
Pathfinding.NavmeshBase:CreateNavmeshSurfaceVisualization(NavmeshTile, GraphGizmoHelper) (at Assets/AstarPathfindingProject/Generators/NavmeshBase.cs:1174)
Pathfinding.NavmeshBase:OnDrawGizmos(RetainedGizmos, Boolean) (at Assets/AstarPathfindingProject/Generators/NavmeshBase.cs:1138)
AstarPath:OnDrawGizmos() (at Assets/AstarPathfindingProject/Core/AstarPath.cs:709)
UnityEditor.DockArea:OnGUI()

Hi

That does indeed look like a bug. I will try to fix it before the next update.
Thanks for reporting this.

As a workaround you should be able to disable the ‘Show Surface’ toggle in the graph settings. This should get rid of the error.

Thanks Aron,

This indeed stopped the error.

I have also noticed that the maximum number of nodes is 255 for the search path ? can this be increased?

What do you mean? Which limit are you referring to here?

well i seem to be returning a null path when the search nodes are over 255, my distances are pretty large… i was wondering if 255 was a hard limit to search nodes or if it can be increased.

anything above this returns null:

Path Completed : Computation Time 1.19 ms Searched Nodes 244 Path Length 48
Path Number 34 (unique id)
UnityEngine.Debug:Log(Object)
AstarPath:LogPathResults(Path) (at Assets/AstarPathfindingProject/Core/AstarPath.cs:763)
AstarPath:m__2(Path) (at Assets/AstarPathfindingProject/Core/AstarPath.cs:1169)
Pathfinding.PathProcessor:CalculatePathsThreaded(PathThreadInfo) (at Assets/AstarPathfindingProject/Core/Misc/PathProcessor.cs:378)
Pathfinding.c__AnonStorey1:<>m__0() (at Assets/AstarPathfindingProject/Core/Misc/PathProcessor.cs:95)

Hi

There should be no limit at 255 searched nodes. There is a limit at 1,000,000 nodes, but that’s mostly for development, because if you have searched more than 1,000,000 nodes it is more likely that something has gone horribly wrong and the pathfinding scripts have got stuck in an infinite loop.
When you say it returns a null path, where do you see this?
Are you sure you are waiting for the path to be calculated before you try to access the .path or .vectorPath variables? (take a look at this page: https://arongranberg.com/astar/docs/calling-pathfinding.php).

Hi Aron, im getting an error that it could not find a node close to the end point, only when the nodes is near 255-300+

how can i make the logging more verbose ? to see what is says

Hi

That the node count is 255-300+ is coincidental. What has happened is that you have requested a path to a point very far away from any place the agent can reach. When a path is requested it will first check for a node close to the start point, then it will try to find a node close to the end point that can be reached from the start node. If it cannot find such a node it will log that error. You can increase the distance that it searches by increasing the A* Inspector -> Settings -> Max Nearest Node Distance. By default I think it is set to 100 world units.

You can make logging more verbose by setting A* Inspector -> Settings -> Path Log Mode to Heavy.

Thanks, i will play around with these settings. I have only been using this for a short time. Awesome work Aron keep it up !

@aron_granberg, just wanted to ask about the state of this bug. I’m guessing that it got forgotten, since it’s been since May!

The problem is simply that the drawer for the gizmos fails when the Recast mesh is, well, larger than 65000 vertices. Yes, we’ll be reducing the vert count! But in the mean time, this shouldn’t be too hard to fix, you’ll just have to subdivide the mesh.