How to get the graph usable by a seeker

  • A* version: 5.4.5
  • Unity version: 6000.3.2f1

Previously (version 5.3.8) I was able to use the following code to find the graph usable by a seeker. (The seeker only has 1 usable graph)

recastGraph = astarPathReference.graphs[Mathf.RoundToInt(Mathf.Log(seeker.graphMask, 2))] as RecastGraph;

This no longer seems to work as of version 5.4.5. How can I accomplish this now? I simply need a reference to the recast graph that the seeker is using.

At first I wasn’t fully understanding but I see now you’re basically trying to get the single graph from the mask. Why this was working on 5.3.8 and not 5.4.5 I’m not fully sure. It looks like the documentation was updated between the two versions, namely related to the nearest node changes so maybe that’s part of it. That’s just speculation and I’ll tag Aron on this to review.

I also want to suggest trying GraphMask.Contains instead? You can iterate through your current graphs and, since you only have 1 usable graph, when you hit that one recast graph, you can save a reference to it that way. Depends on when/how you’d need it.