I finally upgraded from 4.2.15 to 5.1.4 and there are a couple of things that are happening. In my game, the player is able to add objects to the game world and I am calling on AstarPath.active.UpdateGraphs(boxCollider.bounds) on that object’s Start() when the object is added, and the call is not upgrading the graph. I have done some debugging and the method is being called and the collider is working fine.
If I go and manually press “Scan”, the object is recognized. What could be the reason that the UpdateGraphs is not working for me? How can I go ahead and debug more? No errors being logged (it was working fine before the upgrade).
Hi
In version 5, the graphs are now scanned during OnEnable instead of during Awake. In this case, some of your scripts might be scheduling graph updates before the graphs are scanned.
Check the upgrade guide: Upgrade Guide - A* Pathfinding Project
Thanks @aron_granberg! This logic happens when the object is placed while the scene is already been running for a while as the player is already “playing on it”. I’m not running any whole scans or anything other than the objects UpgradeGraphs() when they are placed in the world.
Check if your value of boxCollider.bounds
looks reasonable. For newly instantiated prefabs, it can be incorrect until the physics engine gets time to look at it.
Weird! That seemed to be the issue. I added a small coroutine so it delayed the UpdateGraph for a frame and that did the trick.
Thanks a lot for your help!