diff --git a/src/DotRecast.Detour/DtNavMesh.cs b/src/DotRecast.Detour/DtNavMesh.cs index a479123..54a2db3 100644 --- a/src/DotRecast.Detour/DtNavMesh.cs +++ b/src/DotRecast.Detour/DtNavMesh.cs @@ -1365,6 +1365,11 @@ namespace DotRecast.Detour } public int GetTilesAt(int x, int y, DtMeshTile[] tiles, int maxTiles) + { + return GetTilesAt(x, y, (Span)tiles, maxTiles); + } + + public int GetTilesAt(int x, int y, Span tiles, int maxTiles) { int n = 0; diff --git a/src/DotRecast.Detour/DtNavMeshQuery.cs b/src/DotRecast.Detour/DtNavMeshQuery.cs index 7200a57..4c636e5 100644 --- a/src/DotRecast.Detour/DtNavMeshQuery.cs +++ b/src/DotRecast.Detour/DtNavMeshQuery.cs @@ -797,7 +797,8 @@ namespace DotRecast.Detour m_nav.CalcTileLoc(bmax, out var maxx, out var maxy); const int MAX_NEIS = 32; - DtMeshTile[] neis = new DtMeshTile[MAX_NEIS]; + using RcRentedArray neisRent = RcRentedArray.Rent(MAX_NEIS); + Span neis = neisRent.AsSpan(); for (int y = miny; y <= maxy; ++y) {