- A* version: 5.4.4
- Unity version: 6.1
Here is some code that is run when players open or close doors:
GraphUpdateObject guo = new GraphUpdateObject(NavmeshGUOCollider.bounds) {
modifyWalkability = true,
setWalkability = State != (int)DoorState.Closed,
updatePhysics = false
};
AstarPath.active.UpdateGraphs(guo);
// Set the doors off-mesh link to only affect the tag-specific graphs
ink.graphMask = GameController.Instance.Map.TagsGraphMask;
// Activate the off-mesh link when the door is closed
Link.enabled = State == (int)DoorState.Closed && !IsLocked;
// This seemed to be required to prevent path failed warnings on clients on game load. I guess it forces the graph to be updated immediately with the link changes made above.
Link.Apply();
And here is a deep profile screenshot showing the sources of GC:
Is there any way for me to avoid this GC? Doors can be opened/closed very often by players or AI creatures.
