Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/Assets/Code/AstarPathfindingProject/Core/astarclasses.cs b/Assets/Code/AstarPathfindingProject/Core/astarclasses.cs
- index 18592b1a..df9eb03c 100644
- --- a/Assets/Code/AstarPathfindingProject/Core/astarclasses.cs
- +++ b/Assets/Code/AstarPathfindingProject/Core/astarclasses.cs
- @@ -32,6 +32,7 @@ namespace Pathfinding {
- /// </summary>
- public Color[] _AreaColors;
- + private static int? _hashTemp = null;
- public static Color SolidColor = new Color(30/255f, 102/255f, 201/255f, 0.9F);
- public static Color UnwalkableNode = new Color(1, 0, 0, 0.5F);
- public static Color BoundsHandles = new Color(0.29F, 0.454F, 0.741F, 0.9F);
- @@ -44,10 +45,17 @@ namespace Pathfinding {
- private static Color[] AreaColors = new Color[1];
- public static int ColorHash () {
- + if (_hashTemp != null)
- + {
- + return _hashTemp.Value;
- + }
- var hash = SolidColor.GetHashCode() ^ UnwalkableNode.GetHashCode() ^ BoundsHandles.GetHashCode() ^ ConnectionLowLerp.GetHashCode() ^ ConnectionHighLerp.GetHashCode() ^ MeshEdgeColor.GetHashCode();
- for (int i = 0; i < AreaColors.Length; i++) hash = 7*hash ^ AreaColors[i].GetHashCode();
- - return hash;
- +
- + _hashTemp = hash;
- +
- + return hash;
- }
- /// <summary>
- @@ -86,7 +94,9 @@ namespace Pathfinding {
- ConnectionHighLerp = _ConnectionHighLerp;
- MeshEdgeColor = _MeshEdgeColor;
- AreaColors = _AreaColors;
- - }
- +
- + _hashTemp = null;
- + }
- public AstarColor () {
- // Set default colors
- diff --git a/Assets/Code/AstarPathfindingProject/Generators/NavmeshBase.cs b/Assets/Code/AstarPathfindingProject/Generators/NavmeshBase.cs
- index e4cf9a4e..f9f52ebd 100644
- --- a/Assets/Code/AstarPathfindingProject/Generators/NavmeshBase.cs
- +++ b/Assets/Code/AstarPathfindingProject/Generators/NavmeshBase.cs
- @@ -1312,10 +1312,17 @@ namespace Pathfinding {
- // Update navmesh vizualizations for
- // the tiles that have been changed
- for (int i = 0; i < tiles.Length; i++) {
- - // This may happen if an exception has been thrown when the graph was scanned.
- - // We don't want the gizmo code to start to throw exceptions as well then as
- - // that would obscure the actual source of the error.
- - if (tiles[i] == null) continue;
- + Vector3 worldSpace = tiles[i].transform.InverseTransform(new Vector3(tiles[i].bbTree.Size.center.x, 0, tiles[i].bbTree.Size.center.y));
- + Vector3 screenSpace = Camera.current.WorldToScreenPoint(worldSpace);
- + if (screenSpace.x < 0
- + || screenSpace.y < 0
- + || screenSpace.x > Screen.width
- + || screenSpace.y > Screen.height) continue;
- // Calculate a hash of the tile
- var hasher = new RetainedGizmos.Hasher(active);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement