/// <summary> /// Rebuilds the lookup structure for nodes. /// /// This is used when <see cref="optimizeForSparseGraph"/> is enabled. /// /// You should call this method every time you move a node in the graph manually and /// you are using <see cref="optimizeForSparseGraph"/>, otherwise pathfinding might not work correctly. /// /// You may also call this after you have added many nodes using the /// <see cref="AddNode"/> method. When adding nodes using the <see cref="AddNode"/> method they /// will be added to the lookup structure. The lookup structure will /// rebalance itself when it gets too unbalanced however if you are /// sure you won't be adding any more nodes in the short term, you can /// make sure it is perfectly balanced and thus squeeze out the last /// bit of performance by calling this method. This can improve the /// performance of the <see cref="GetNearest"/> method slightly. The improvements /// are on the order of 10-20%. /// </summary> public void RebuildNodeLookup() { if (!optimizeForSparseGraph || nodes == null) { lookupTree = new PointKDTree(); } else { lookupTree.Rebuild(nodes, 0, nodeCount); } }
// Token: 0x060025B9 RID: 9657 RVA: 0x001A1748 File Offset: 0x0019F948 public void RebuildNodeLookup() { if (!this.optimizeForSparseGraph || this.nodes == null) { this.lookupTree = new PointKDTree(); return; } PointKDTree pointKDTree = this.lookupTree; GraphNode[] array = this.nodes; pointKDTree.Rebuild(array, 0, this.nodeCount); }