- Home /
 
               Question by 
               ZimonD · Aug 26, 2012 at 09:48 AM · 
                gameobjectpathfindingdeletegraphastar  
              
 
              Update Graph after GameObject destruction
Hi,
My question is, as the title states, how can I update the graph with the old bounds of the GameObject after the object has been destroyed (making it free for movement)
My code atm:
 // Temporarily saving the collider bounds for A*
 var temp: Bounds = collider.bounds;
 
 // Destroy the actual GameObject
 Destroy(this.gameObject);
 
 // Making sure A* removes it from the pathfinding:
 print("Removing from A*, Bounds=" + temp + ", GameObject=" + this.gameObject);
 AstarPath.active.UpdateGraphs(temp);
Thanks in advance, ~Z
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by ZimonD · Aug 29, 2012 at 06:07 PM
After asking the author of A*, he pointed me to an overload of the UpdateGraph function that accepted an delay:
 AstarPath.active.UpdateGraphs(temp, 1); // Second parameter is the delay
This fixed the problem.
-Z
Thanks a lot. Three years later and this is the best answer I could find. Worked like a charm. I'll post on the forum and see if there have been any changes.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                