Error thrown when I reload a scene

Hi Everyone,

This is an odd issue. I’ve got my pathfinding running smoothly, just as i need it. However I’ve just implemented the ‘Start this level again’ functionality and I’m issuing a LoadScene command

SceneManager.LoadScene(SceneManager.GetActiveScene().name);

when the scene reloads a number of errors are thrown:

Not allowed to access vertices on mesh ‘Rock_Type2_01_mesh’ (isReadable is false; Read/Write must be enabled in import settings)
UnityEngine.Mesh:get_vertices()
Pathfinding.Recast.RecastMeshGatherer:CollectSceneMeshes(List`1) (at Assets/AstarPathfindingProject/Generators/Utilities/RecastMeshGatherer.cs:75)
Pathfinding.RecastGraph:CollectMeshes(Bounds) (at Assets/AstarPathfindingProject/Generators/RecastGenerator.cs:746)
Pathfinding.c__Iterator1:MoveNext() (at Assets/AstarPathfindingProject/Generators/RecastGenerator.cs:659)
Pathfinding.c__Iterator0:MoveNext() (at Assets/AstarPathfindingProject/Generators/RecastGenerator.cs:582)
c__Iterator3:MoveNext() (at Assets/AstarPathfindingProject/Core/AstarPath.cs:1799)
c__Iterator2:MoveNext() (at Assets/AstarPathfindingProject/Core/AstarPath.cs:1736)
AstarPath:Scan(NavGraph[]) (at Assets/AstarPathfindingProject/Core/AstarPath.cs:1608)
AstarPath:Awake() (at Assets/AstarPathfindingProject/Core/AstarPath.cs:1278)

Now the problem may not be with the pathfinding, But I can’t understand why the scene launched from the ditor but errors when the scene is reloaded in code? Any help appreciated.

cheers

Ian

Hi

I’m not sure why that would only show up when reloading the scene, are you sure that particular mesh also existed when the scene was first loaded? (maybe it was on an object that was created after loading it and marked with DontDestroyOnLoad or something like that?).

To avoid the error you should just do exactly what it says in the message. The pathfinding scripts cannot access the vertices unless you enable it in the import settings.