I’m working on a project (a runner game) where segments are added in and removed as one would expect for this type of game. I have a player object that will basically always be the world center. I tried updating my graphs doing the following:
RecastGraph recastGraph = AstarPath.active.data.recastGraph; recastGraph.forcedBoundsSize = new Vector3(150f, 8f, 150f); recastGraph.forcedBoundsCenter = runnerFollower.cameraTarget.transform.position; recastGraph.Scan();
The problem is that this causes a very noticeable lag in gameplay. Would there be a better way to go about this? I’m calling this code whenever a section is added or removed from my world.