Struct TileMeshes

Public

Represents a rectangular group of tiles of a recast graph.

This is a portable representation in that it can be serialized to and from a byte array.

// Scans the first 6x6 chunk of tiles of the recast graph (the IntRect uses inclusive coordinates)
var graph = AstarPath.active.data.recastGraph;
var buildSettings = RecastBuilder.BuildTileMeshes(graph, new TileLayout(graph), new IntRect(0, 0, 5, 5));
var disposeArena = new Pathfinding.Jobs.DisposeArena();
var promise = buildSettings.Schedule(disposeArena);

AstarPath.active.AddWorkItem(() => {
// Block until the asynchronous job completes
var result = promise.Complete();
TileMeshes tiles = result.tileMeshes.ToManaged();
// Take the scanned tiles and place them in the graph,
// but not at their original location, but 2 tiles away, rotated 90 degrees.
tiles.tileRect = tiles.tileRect.Offset(new Int2(2, 0));
tiles.Rotate(1);
graph.ReplaceTiles(tiles);

// Dispose unmanaged data
disposeArena.DisposeAll();
result.Dispose();
});

See

NavmeshPrefab uses this representation internally for storage.

RecastGraph.ReplaceTiles

RecastBuilder.BuildTileMeshes

Public Methods

Rotate (rotation)

Rotate this group of tiles by 90*N degrees clockwise about the group's center.

Public
Serialize ()

Serialize this struct to a portable byte array.

Public

Public Static Methods

Deserialize (bytes)

Deserialize an instance from a byte array.

Public Static

Public Variables

tileMeshes

Tiles laid out row by row.

Public
tileRect

Which tiles in the graph this group of tiles represents.

Public
tileWorldSize

World-space size of each tile.

Public