Greetings, I’m using the free 4.2.15 version.
I have been encountering this weird bug in 2D pathfinding.
Before each time I click the play button in the inspector, I need to select the GameObject
the Pathfinding
(AStarPath) is attached to in the inspector; otherwise, the script would not initialize as if it did not exist.
Therefore, causing “There are no graphs in the scene” error. And there really is no graph under my A* GameObject, the existing graph was just gone.
And also, the Scan on awake under settings also doesn’t work, I need to manually click the scan button for the graph to update.
Then I tried creating a new GridGraph
through script during runtime.
It would even cause “NullReferenceException at AstartData.cs at line 537”.
I used AstarPath.active.data.AddGraph();
I’m sure that all scripts are executed from Start()
functions, not Awake()
.
I have tried putting A* related scripts earlier in the execution order.
I have tried re-importing the package.
I have also tried yield return new WaitForEndOfFrame()
Then I even created a singleton to get direct reference to the Pathfinding script, but nothing works.
Please advise. Thank you.