"[GameResource] and NavMesh.GetSimplePath are obsolete on engine 26.07 — use [AssetType] and CalculatePath"
▸ SYMPTOM
A build that treats warnings as errors fails with CS0618 (member is obsolete) on two APIs that used to be idiomatic: the [GameResource(...)] attribute, and scene.NavMesh.GetSimplePath(...). Verified on engine 26.07.15a (found via offline metadata reflection over bin/managed when building headless).
▸ CAUSE
Both were deprecated in favour of newer surfaces:
GameResourceAttributenow derives fromAssetTypeAttributeand is itself deprecated.NavMesh.GetSimplePath(which returned aList<Vector3>) is superseded byNavMesh.CalculatePath, whose result shape is different.
A zero-warnings gate that compiled clean on an earlier engine will now fail on both.
▸ FIX
Each modern replacement compiles clean:
1. Resource attribute — use [AssetType]:
// old (obsolete):
[GameResource( "NPC Definition", "npc", "An NPC archetype", Icon = "..." )]
// new:
[AssetType( Name = "NPC Definition", Extension = "npc", Category = "..." )]
public class NpcDefinition : GameResource { ... }AssetType exposes Name / Extension / Category / IconColor / Flags. There is no Description or Icon constructor argument — drop them. The base class stays : GameResource.
2. Pathfinding — use CalculatePath:
// old (obsolete): List<Vector3>
var pts = scene.NavMesh.GetSimplePath( from, to );
// new:
var path = scene.NavMesh.CalculatePath(
new Sandbox.Navigation.CalculatePathRequest { Start = from, Target = to } );
if ( path.IsValid )
foreach ( var p in path.Points ) // IReadOnlyList<NavMeshPathPoint>
Use( p.Position ); // each point exposes .Position (Vector3)CalculatePath returns a NavMeshPath struct with .IsValid and .Points, an IReadOnlyList<NavMeshPathPoint>. It is not a List<Vector3>, so index the position via path.Points[i].Position.
Related navmesh surface that is not deprecated: Scene.NavMesh.IsEnabled (gates whether a baked navmesh exists — the scene default is disabled), and GetRandomPoint( pos, radius ) / GetClosestPoint( pos, radius ) returning Vector3?.
▸ WHY IT WORKS
The obsolete members still exist for source compatibility but emit CS0618, which a warnings-as-errors gate promotes to a hard failure. Moving to [AssetType] and CalculatePath targets the current, non-deprecated API surface, so the gate passes and you're aligned with the shape the engine will keep supporting.
- Published.