Need to prebake a very large grid of a custom type "Node".
I'm working on A* pathfinding that uses a custom type "Node".
public class Node
{
public int x;
public int y;
public int z;
public float hCost;
public float gCost;
public float fCost
{
get
{
return gCost + hCost;
}
}
public Node parentNode;
public bool accessable = true;
}
The master grid is a multidimensional (3d)array of type Node[, ,] and made up of 9,375,000 Nodes. It is very large and takes several minutes to bake.
When creating nodes, I must use Physics.BoxCastAll to check for colliders at the nodes position so as far as I can tell, the only way to make the grid is during runtime.
Once the grid is created, accessing it is smooth as butter but the problem is generation obviously takes way to long without murdering framerate. Is there a way I can set this up to run in the editor? Can the editor check for colliders the way physics.boxcastall does? If not where can I find information on how to save my custom Node data once it's been generated and load it at runtime?
Note: The level is more or less static and if something is changed I can update the specific nodes at the position in the grid fairly easily. A single master bake is really all I need to get this working.
Thank you very much in advance.