首先。官方文档:Graph Updates during Runtime - A* Pathfinding Project (arongranberg.com)
一、官方内容主要说基于Collider的物理检测更新(updatePhysics)不可行走区域。
// using Pathfinding; //At top of script
// As an example, use the bounding box from the attached collider
Bounds bounds = GetComponent<Collider>().bounds;
var guo = new GraphUpdateObject(bounds);
// Set some settings
guo.updatePhysics = true;
AstarPath.active.UpdateGraphs(guo);
(1)、优点。一目了然的写法,根据指定(collider)的范围计算是否可行走。
(2)、缺点。这种方式可能会重新计算指定collider周围的格子。下面是官方说明
Grid graphs will work as you expect, you can