Hello, I am a fairly new Unity developer (not new to development, just Unity). I’m loving the ease of use of the A* framework.
(Note, this is probably going to be a really stupid question and I’m probably over-thinking it but I haven’t been able to find any documentation on how colliders are enabled/disabled or how their size gets updated)
I’ve been running into a bit of an issue trying to do blocking detection. I have a button that when pressed instantiates a new wall object. This new wall’s object’s collider is disabled so that it does not affect running gameplay while being placed.
From what I can tell, when Unity enables a collider, the collider’s size is not immediately apparent. From my observations, calling UpdateGraph directly after enabling the collider does not update the graph to reflect the new collider.
To do my blocking detection, I enable the collider, wait 1 frame (Set boolean, next Update() check for boolean, reset and continue calculation) then update the graphs. This causes some problems with actual gameplay; for example, if one were to hold down this placement button the collider would eventually collide with another game object causing them to veer off course.
Does anyone have any suggestions on how to force the detection of the new collider on the same frame? I tried to find all the nodes in my bounds (Using GridGraph.GetNodesInArea) and setting them to unwalkable, but I couldn’t find out how to get the GraphUpdateUtilities.UpdateGraphsNoBlock to detect that change and then revert. Any help would be much appreciated.