stride3d/stride · error · ArgumentException
Please add a NavigationComponent to the entity containing…
Error message
Please add a NavigationComponent to the entity containing PlayerController with the correct navigation mesh!
What it means
PlayerController (Stride navigation test script) requires a NavigationComponent on the same entity to receive pathfinding services. During Start(), Entity.Get<NavigationComponent>() returns null, so the script throws this ArgumentException to signal missing scene configuration.
Solutions
- Add a NavigationComponent to the same entity as the PlayerController.
- Assign a built/valid navigation mesh to that NavigationComponent.
- Verify in the scene editor that both components are on one entity before running.
- Null-check Navigation in code if you author PlayerController variants dynamically.
Example fix
// before
Entity.Components.Add(new PlayerController()); // no NavigationComponent
// after
Entity.Components.Add(new NavigationComponent { NavigationMesh = myNavMesh });
Entity.Components.Add(new PlayerController()); Defensive patterns
Strategy: validation
Validate before calling
if (Entity.Get<NavigationComponent>() == null)
throw new InvalidOperationException("Attach a NavigationComponent to the PlayerController entity before running."); Type guard
bool HasNavigation(Entity e) => e.Get<NavigationComponent>() != null;
Try / catch
try { playerController.Start(); } catch (ArgumentException ex) when (ex.Message.Contains("NavigationComponent")) { Log.Error("Scene misconfigured: add NavigationComponent"); } Prevention
- Always attach NavigationComponent, CharacterComponent and PlayerController to the same entity
- Assign a valid built navigation mesh in the component
- Validate scene composition in an editor script or unit test before runtime
- Keep scene setup scripted/templated to avoid manual mistakes
When it happens
Trigger: Start() is called on an entity that has a PlayerController script but no NavigationComponent attached in the scene editor.
Common situations: Forgetting to add the NavigationComponent in Game Studio; adding it to a different entity than the PlayerController; the navigation mesh not assigned in the NavigationComponent.
Understand the failure class
Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.
Related errors
- Please add a CharacterComponent to the entity containing…
- Custom strides is not supported with packed PixelFormats
- Overlapping update commands
- No Voxel Volume Component selected for voxel light.
- Unable to find the base
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/85097cdc2321548c.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.Navigation.Tests/PlayerController.cs:69
private bool ReachedDestination => waypointIndex >= pathToDestination.Count;
private Vector3 CurrentWaypoint => waypointIndex < pathToDestination.Count ? pathToDestination[waypointIndex] : Vector3.Zero;
private MoveResult pendingResult;
private TaskCompletionSource<MoveResult> taskCompletionSource;
/// <summary>
/// Called when the script is first initialized
/// </summary>
public override void Start()
{
base.Start();
// Get the navigation component on the same entity as this script
Navigation = Entity.Get<NavigationComponent>();
if (Navigation == null) throw new ArgumentException("Please add a NavigationComponent to the entity containing PlayerController with the correct navigation mesh!");
// Will search for an CharacterComponent within the same entity as this script
Character = Entity.Get<CharacterComponent>();
if (Character == null) throw new ArgumentException("Please add a CharacterComponent to the entity containing PlayerController!");
moveDestination = SpawnPosition;
}
public void Reset()
{
pathToDestination.Clear();
HaltMovement();
moveDestination = SpawnPosition;
Character.Teleport(SpawnPosition);
}
public override void Update()
{View on GitHub (pinned to 96fad776d2)