Load graph from TextAsset and change center position

I have a 2D rogue-like game with procedurally generated dungeons. Every dungeon is made of rooms and every room has a set of obstacles with some enemies in it (every enemy uses the pathfinder to reach the player). Since only one room is active at a given time, every time the player enters a room I change the graph center via code (the graph has a fixed width and height) and rescan.
On lower-end devices it can be a little slow at times, so I want to be able to cache every single possible room in a bunch of textasset files and load each one at runtime when needed.
However, even though the graph nodes stay the same, the center of the graph needs to be changed when needed.
How can I accomplish this?


You can use the GridGraph.RelocateNodes method.

I figured that out thanks.
But loading from file seems still pretty slow (also allocates more than 1MB for a simple 40x40 graph), so I was wondering if there were any optimisations that could be done (the saved graph textasset is a little over 10kb)

A 40x40 graph shouldn’t be that slow to load. Do you think you could show the profiler output for this?