Error getting mesh readability when scanning

Hi all,

I am having problems with the Scan function used in scripts for RecastGraph. When I use AstarPath.active.Scan() I always get an error saying that it’s not allowed to access vertex data, and complains about the isReadable (Read/Write in the import settings), but all of my assets have this Read/Write option disabled, and it only complains about some of them. It’s solved by checking the Read/Write option, but I don’t think this is the intended behavior (and not even a recommended one). I am using the last beta version (4.3.3.34) and Unity 2020.1.5f1.

The full stacktrace of the error is this:

InvalidOperationException: Not allowed to access vertex data on mesh 'Rename_01' 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 <a9810827dce3444a8e5c4e9f3f5e0828>:0)
UnityEngine.Mesh.AcquireReadOnlyMeshData (System.Collections.Generic.List`1[T] meshes) (at <a9810827dce3444a8e5c4e9f3f5e0828>:0)
Pathfinding.Recast.RecastMeshGathererBurst.Finalize () (at Library/PackageCache/com.arongranberg.astar@4.3.34/Generators/Utilities/RecastMeshGathererBurst.cs:93)
Pathfinding.RecastGraph.CollectMeshesBurst (UnityEngine.Bounds bounds) (at Library/PackageCache/com.arongranberg.astar@4.3.34/Generators/RecastGenerator.cs:1140)
Pathfinding.RecastGraph+<ScanAllTilesBurst>d__53.MoveNext () (at Library/PackageCache/com.arongranberg.astar@4.3.34/Generators/RecastGenerator.cs:761)
Pathfinding.RecastGraph+<ScanInternal>d__46.MoveNext () (at Library/PackageCache/com.arongranberg.astar@4.3.34/Generators/RecastGenerator.cs:602)
AstarPath+<ScanGraph>d__143.MoveNext () (at Library/PackageCache/com.arongranberg.astar@4.3.34/Core/AstarPath.cs:1847)
AstarPath+<ScanInternal>d__142.MoveNext () (at Library/PackageCache/com.arongranberg.astar@4.3.34/Core/AstarPath.cs:1774)
AstarPath.Scan (Pathfinding.NavGraph[] graphsToScan) (at Library/PackageCache/com.arongranberg.astar@4.3.34/Core/AstarPath.cs:1626)

Also I have the errors from this 2 posts, but they are fixed and they will be there in the next update, I guess?


Thanks!

You need to enable read / write on the import settings of meshes that are getting scanned. So according to your stacktrace you have to find the Asset with mesh Rename_01 in it and set it to Read / Write enabled = true.

Hi! Yes, I know that fixes it, but the “mystery” was knowing why it was complaining about some meshes and not about others, and now I know why. Turns out that I am using unity regular colliders in the 99% of the props that I have, but some of them still have the mesh collider, and as I didn’t need the mesh to be readable, it was not checked. So, problem solved!

Anyway, I still have the issues ith the burst and the the native array, it is fixed but not committed to the beta branch, right?