Game.Prefabs.PathfindPedestrianData
Assembly: Assembly-CSharp.dll (game runtime types are typically in Assembly-CSharp.dll)
Namespace: Game.Prefabs
Type: struct
Base: IComponentData, IQueryTypeParameter
Summary:
Holds pathfinding cost configuration for pedestrian pathfinding. This component groups several PathfindCosts entries used by the pathfinder to evaluate pedestrian routes and spawn points: walking cost, crosswalk cost, unsafe crosswalk cost and spawn cost. Attach to entities or use as a query parameter so pathfinding systems can read the configured costs when computing routes.
Fields
-
public PathfindCosts m_WalkingCost
Represents the baseline cost for walking on a segment (used for normal sidewalk/street segments). This cost influences route selection for pedestrians when preferring or avoiding certain surfaces. -
public PathfindCosts m_CrosswalkCost
Cost modifiers applied when a pedestrian uses a crosswalk. Typically lower than unsafe crosswalk cost to prefer marked crossings where available. -
public PathfindCosts m_UnsafeCrosswalkCost
Cost modifiers for crossing locations that are not formal/marked crosswalks (e.g., jaywalking, unprotected crossings). Usually higher to discourage unsafe crossings unless necessary. -
public PathfindCosts m_SpawnCost
Cost/penalty applied when spawning pedestrians at or near a location; can influence spawn position selection or initial path segment selection.
Properties
- None (this is a plain data struct used as an ECS component / query parameter).
Constructors
public PathfindPedestrianData()
Default value-type constructor provided by C#. Initialize fields explicitly when creating an instance to ensure deterministic costs.
Methods
- None (no methods defined on this struct).
Usage Example
// Example: creating and assigning the component to an entity using the EntityManager.
// PathfindCosts is a placeholder type here — initialize according to its actual definition.
var pedestrianCosts = new PathfindPedestrianData
{
m_WalkingCost = new PathfindCosts(/* ... initialize walking cost ... */),
m_CrosswalkCost = new PathfindCosts(/* ... initialize crosswalk cost ... */),
m_UnsafeCrosswalkCost = new PathfindCosts(/* ... initialize unsafe crosswalk cost ... */),
m_SpawnCost = new PathfindCosts(/* ... initialize spawn cost ... */)
};
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity e = entityManager.CreateEntity(typeof(PathfindPedestrianData));
entityManager.SetComponentData(e, pedestrianCosts);
// Or add to an existing entity:
// entityManager.AddComponentData(existingEntity, pedestrianCosts);