InvalidOperationException: Not allowed to access vertex data on mesh

Hi! Im use unity URP 2020.2.4f1 and A* 4.3.30. I have scene with one model. When a start this scene it works nice but if i start empty scene and load scene with A* and model(Read/WriteEnable off) it doesnt work. A* turns off automatically and print this error.

InvalidOperationException: Not allowed to access vertex data on mesh ‘SM_Prop_Powerpole_Broken_03’ at array index 0 (isReadable is false; Read/Write must be enabled in import settings)
UnityEngine.Mesh+MeshDataArray…ctor (UnityEngine.Mesh[] meshes, System.Int32 meshesCount, System.Boolean checkReadWrite) (at <2fae0a4cbcec42c9acc616494aa88f69>:0)
UnityEngine.Mesh.AcquireReadOnlyMeshData (System.Collections.Generic.List`1[T] meshes) (at <2fae0a4cbcec42c9acc616494aa88f69>:0)
Pathfinding.Recast.RecastMeshGathererBurst.Finalize () (at Library/PackageCache/com.arongranberg.astar@4.3.40/Generators/Utilities/RecastMeshGathererBurst.cs:94)
Pathfinding.RecastGraph.CollectMeshesBurst (UnityEngine.Bounds bounds) (at Library/PackageCache/com.arongranberg.astar@4.3.40/Generators/RecastGenerator.cs:1140)
Pathfinding.RecastGraph+d__53.MoveNext () (at Library/PackageCache/com.arongranberg.astar@4.3.40/Generators/RecastGenerator.cs:761)
Pathfinding.RecastGraph+d__46.MoveNext () (at Library/PackageCache/com.arongranberg.astar@4.3.40/Generators/RecastGenerator.cs:602)
AstarPath+d__143.MoveNext () (at Library/PackageCache/com.arongranberg.astar@4.3.40/Core/AstarPath.cs:1847)
AstarPath+d__142.MoveNext () (at Library/PackageCache/com.arongranberg.astar@4.3.40/Core/AstarPath.cs:1774)
AstarPath.Scan (Pathfinding.NavGraph[] graphsToScan) (at Library/PackageCache/com.arongranberg.astar@4.3.40/Core/AstarPath.cs:1626)
AstarPath.Awake () (at Library/PackageCache/com.arongranberg.astar@4.3.40/Core/AstarPath.cs:1277)

If a toggle on Read/WriteEnable it works fine but i think its a bad idea to toggle this option on every single model in project. I try create new empty unity project(non URP) and import the same model but nothing change.Sorry for my english)

Hi

If read/write is not enabled the script literally cannot read the mesh data, so it cannot use it to generate the graph. You can switch to only rasterizing colliders instead of meshes to work around this requirement.

Also, it is a bug that it throws an exception. It should just log an error message. I will fix this.

1 Like

Hi! I try to switch rasterizing colliders instead of meshes but its still dont working. Pring the same error.

Hi

It may be that you have a mesh collider that isn’t readable (though that’s odd, because they would always be required to be readable by unity anyway).