public readonly struct NavPolyRefA polygon in a NavMesh, named in a way that survives the tile going away.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Three fields packed into one 64-bit value: the salt of the tile slot, the slot itself, and the polygon's index inside it. A path is a list of these, an agent holds one for the polygon it is standing on, and both may outlive the tile they name — a streamed level unloads tiles while agents are mid-path, and a rebaked tile reuses the slot.
The salt is what makes that safe. It increments every time a slot is reused, so a reference into the previous occupant does not resolve: TryGetPoly returns rather than silently answering about a different polygon that happens to have the same index. A bare tile-and-index pair would have no way to tell those two cases apart, and the failure mode is an agent walking a path through geometry that no longer exists.
Null is the zero value, which is what a default struct and a cleared array already hold. Salts therefore start at one.
Fields and properties (7)
public static NavPolyRef NullThe reference that names no polygon.
public bool IsNullWhether this names no polygon.
public int TileThe tile slot.
public int PolyThe polygon's index within its tile.
public uint SaltThe salt the tile slot had when this reference was made.
public static int MaxTilesThe largest tile slot a reference can name, plus one.
public static int MaxPolysPerTileThe largest polygon count a tile can hold.
Methods (9)
public static NavPolyRef Encode(uint salt, int tile, int poly)Packs a reference.
public ulong ToUInt64()The packed value, for storing a reference somewhere that only holds numbers.
public static NavPolyRef FromUInt64(ulong value)Unpacks a value produced by ToUInt64.
public bool Equals(NavPolyRef other)Indicates whether the current object is equal to another object of the same type.
public override bool Equals(object? obj)Indicates whether this instance and a specified object are equal.
public override int GetHashCode()Returns the hash code for this instance.
public static bool operator ==(NavPolyRef left, NavPolyRef right)Whether two references name the same polygon of the same tile occupant.
public static bool operator !=(NavPolyRef left, NavPolyRef right)Whether two references differ.
public override string ToString()Returns the fully qualified type name of this instance.
Used by (34)
- CrowdBenchmarksVixen.Benchmarks.Navigation
- PathQueueBenchmarksVixen.Benchmarks.Navigation
- QueryBenchmarksVixen.Benchmarks.Navigation
- AgentVixen.Navigation
- CrossTileConnectionTestsVixen.Navigation.Tests
- CrowdVixen.Navigation
- CrowdAgentStateVixen.Navigation
- CrowdRetargetTestsVixen.Navigation.Tests
- DetailMeshTestsVixen.Navigation.Tests
- HeightfieldTestsVixen.Navigation.Tests
- NavAreaVolumeTestsVixen.Navigation.Tests
- NavLinkVixen.Navigation
- NavMeshVixen.Navigation
- NavMeshAssetTestsVixen.Navigation.Tests
- NavMeshDebugDrawVixen.Navigation
- NavMeshDebugDrawTestsVixen.Navigation.Tests
- NavMeshQueryVixen.Navigation
- NavMeshQueryTestsVixen.Navigation.Tests
- NavPathPointVixen.Navigation
- NavPathQueueVixen.Navigation
- NavPathQueueJobTestsVixen.Navigation.Tests
- NavPathQueueTestsVixen.Navigation.Tests
- NavRaycastHitVixen.Navigation
- NavTileCacheTestsVixen.Navigation.Tests
- NavigationAllocationTestsVixen.Navigation.Tests
- NeighbourVixen.Navigation
- NeighbourEnumeratorVixen.Navigation
- NodeVixen.Navigation
- OffMeshConnectionTestsVixen.Navigation.Tests
- PathCorridorVixen.Navigation
- RegionMergeTestsVixen.Navigation.Tests
- SlotVixen.Navigation
- WatershedTestsVixen.Navigation.Tests
- NavMeshImporterTestsVixen.Editor.Assets.Tests