Best practice for disabling and enabling grid graphs at run time?

I have an object with a pathfinder script that contains several different grid graphs. Not all of these graphs are necessary at all times, and I would like to be able to essentially disable and re-enable the graphs for optimization purposes. I’ve tried several ways of doing this, but each of these methods has resulted in issues popping up (error messages, spikes in the profiler, etc.). Is there an optimal way to accomplish what I’m trying to do?


Graphs that you don’t use do not cost any significant amount of performance. They mostly just use up memory (and you’d have to store the graph somewhere anyway). So unless you are running into memory issues I’d recommend leaving them enabled all the time.