I’m just starting to use A* in a simulator I’m creating for my college project.
I’ve added a button to reset the scene in Unity on click. I’ve tried 2 different ways of scene reset also.
public void ResetScene()
{
//SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
Scene scene = SceneManager.GetActiveScene();
SceneManager.LoadScene(scene.name);
print("Scene Restarted");
Time.timeScale = 1f;
}
Unfortunately on button click, while the scene does appear to reload, I get errors only relating to “Assets/AstarPathfindingProject/”.
Some of the errors in the console are:
Not allowed to access vertices on mesh ‘SM_Prop_Couch_05’ (isReadable is false; Read/Write must be enabled in import settings)
UnityEngine.Mesh:get_vertices ()
Not allowed to access triangles/indices on mesh ‘SM_Prop_Couch_05’ (isReadable is false; Read/Write must be enabled in import settings)
UnityEngine.Mesh:get_triangles ()
Not allowed to access triangles/indices on mesh ‘SM_Buildings_WallDoorDouble_5x3_01P’ (isReadable is false; Read/Write must be enabled in import settings)
UnityEngine.Mesh:get_triangles ()
Nothing else reports an error. I don’t understand why changing a setting in imports will resolve this issue when resetting the scene. This error does not show on first load. Only if I click my reset scene button.
Is there someway to gracefully reload a scene that has A* in it please?
In Unity, reading from non-readable meshes is only allowed in some circumstances. During runtime Unity usually does not allow it, but it is a bit inconsistent in how it enforces it.
The recast graph needs to read the meshes in order to be able to generate the graph. In the current version, the error messages are not great, but they have been improved in the beta version (along with some nicer UI).
To solve this, you can either make those meshes readable, or change the recast graph to rasterize colliders instead of meshes.
You can also read more about alternative solutions in the section Some meshes were statically batched... on this page: Error messages - A* Pathfinding Project
Thank you aron for your reply.
How do I make them readable please? I’ve searched Google but all it says is to tick a box on import, except when I import the package I can’t see the option to make them readable.
I’m using the free unity package POLYGON Starter Pack - Low Poly 3D Art by Synty as one part that has this issue.