My layout is huge, but I only need Pathfinding to work on a small portion of it. However, when an object with Pathfinding behavior is spawned, there is a 2 seconds lag because the obstacle map is automatically generated for the entire layout.
Is there any way (maybe some trick or hack) to avoid this?
I thought the obstacle map was only generated on layout start, unless you are calling it to regenerate when you spawn that specific object? If so couldn't you use regenerate region to cover the area you want?
It is generated on layout start, if there are instances with Pathfinding behavior. There will still be the lag, but on layout start. Also, it's regenerated if you load a saved game, again with the lag.
Develop games in your browser. Powerful, performant & highly capable.
Regenerate region?
I'm talking about the initial obstacle map generation. It's taking a lot of time because of the huge layout size. After that I can do "Regenerate region" and it's executed much faster. What I need is a way to skip that initial map generation.
It can't have a partial map.
You would do that at the beginning of the layout.
I may have found a partial solution. Set Obstacles: custom in behavior properties, spawn the object, then add obstacles and regenerate the region around. Because when the object is created it has no obstacles, the full map generation happens much faster and the initial lag is small.
Well yeah you have to regenerate when you add obstacles anyway.
Also I don't think the object has to exist.