Scene Reset Leads to "Not allowed to access..." Errors

Hello,

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?

Thanks for your time!

Hi

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.

I also tried to add the component “RecastMeshObj” and set things as walkable and walls as not walkable but this didn’t make a difference.
https://arongranberg.com/astar/documentation/dev_4_0_6_e07eb1b/class_pathfinding_1_1_recast_mesh_obj.php

Is there a quick and dirty way of in code setting everything to readable to get this working please?

Hi

You select the mesh in the inspector and check the readable box:

In the beta version there’s a nice UI in the recast settings for easily marking those meshes as readable. But not in the currently released version.

Thank you again for your quick reply. I can’t find that option for the synty prefabs unfortunately.

Your other solution, I’ve tried finding documntation on but can only find this:
https://arongranberg.com/astar/docs/recastmeshgatherer.html#RasterizeCollider

Perhaps you could point me in he direction on how to “change the recast graph to rasterize colliders instead of meshes” please?

If you go to the recast graph settings, there’s a checkbox for “Rasterize Meshes” and one for “Rasterize Colliders”.

It’s not on the prefabs, it’s on the meshes.

1 Like

Thank you again for your help and patients with my lack of knowledge. Very much appreciated. I’ll try that now aron.

Great news Aron! That appears to have removed the errors! Thank you!

For anyone else experiencing the same issue, the steps I took to resolve are:

  1. Click on error message in Console to expand it and allow highlighting and copying of the mesh name with the issue.

  2. Then click back into Project (instead of Console) and search for this text. You can filter to just “Models” to help.

  3. Then click the tick box beside Read/Write and hit “Apply” after.

Done! Issue resolved!

PS: I’ve tried to attach screenshots but not sure its working correctly.