Random terrain navigation

Hi,
in my game is terrain represented by cubes and each of these cubes have on each side instantiated terrain, cubes are also rotating over time so I dont know how to do navigation. On each terrain is also randomly instantiated trees, flowers but I think I can use dynamic obstacle script on them. Is here any way how to create navigation for each tarrain prefab and when they are instantiated in game AI will use them? Or how to do navigation for this kind of game?
I hope you understand me.
Thank you for answer.

Hm, I don’t really understand how your game world is set up. Do you think you could post a screenshot?

Thank you for answer. Sure here is screenshot from editor
Terrain in each side of cube is prefab that is randomly chose and instantiated when game starts. Each cube is rotating over time.
I think best option will be create navigation for each terrain prefab and game will use that when prefab is instantiated in game, but I dont know if is this possible.
I hope you understand my terrain system better now.

The solution I have in mind involves setting up a line of terrains in the world which are hidden and you calculate graphs on them when you instantiate a new cube side, and when you want to find a path on a cube’s side, you first transform the coordinates to local coordinates relative to the cube’s side and then offset them to be at the correct graph for the prefab, this will free you from having to relocate the graphs which may be expensive. Do you have a limited number of possible terrains or are all generated slightly differently. What I want to know is if it would be possible to use one graph for several of the terrains.

I dont think I understand you correctly. For now I have 15 different terrain prefabs if you ask for that:)

And they will always be the same, you will not change one instantiation, like for example add a tree to only one cube side, but not the others?

And also. Do your units need to be able to pathfind between the cube sides or just within one side?

every terrain prefab have spots where is chance to spawn tree, flower,… when game start.
units will walk only on the top of cubes.

ok, but they can walk between cubes, so that a unit on the top of one cube can walk to the top of the next cube, right?

exactly

Ok. Then I actually think that, since the individual cube sides are so small, you could have one graph which covers all the top sides of the cubes, and then when a cube has rotated to a new orientation, you issue a graph update only on that region of the graph. While the cubes are rotating, you would have a graph update issued over that region which sets all nodes to unwalkable to prevent units from walking there.

ok I will try something and give you know. thank you

Hi,
I have absolutely no idea which code use to update graph only on coordinates:( I just found update function for whole graph and that cause huge lags.

See http://arongranberg.com/astar/docs/graph-updates.php#scripting

wow thanks a lot, it is work like a charm. I give it some test but for now it is perfect.