Unity traffic and pedestrian system — pedestrians crossing while cars wait at the line in a city scene

Complete City Traffic & Pedestrian System for Unity

Traffic and pedestrian AI for Unity — waypoint-driven, no NavMesh, full C# source.

Two systems in one package

This Unity traffic and pedestrian system drops a full city simulation into your project: cars that obey traffic lights, overtake, give way and clear the road for emergency vehicles, and pedestrian crowds that walk the pavements, wait at crossings and avoid each other and the traffic. Both systems are waypoint-driven, Burst-compiled and built mobile-first, so a busy street costs you frames you can afford. Complete commented C# source is included — nothing is hidden behind a DLL.

The traffic engine at the core of this package was nominated for Best Development Tool at the Unity Awards 2021 and is rated 4.8/5 from 65 ratings on the Unity Asset Store — more reviews than any competing traffic asset.

This package bundles both of Gley’s city-simulation systems and a ready-made example scene showing them running together on the same road network.

Mobile Traffic System

The vehicle half. Waypoint-based pathfinding, automatic overtaking and lane changing on multi-lane roads, full intersection management — traffic lights, priority intersections, roundabouts and give-way — plus speed zones, per-car-type road restrictions, automatic headlights, blinkers and engine sound. See the full Mobile Traffic System page.

Mobile Pedestrian System

The crowd half. Grid-based waypoint pathfinding that scales to any scene size, root-motion movement that works with any humanoid rig and animation set, traffic-light-aware street crossing, static and dynamic obstacle avoidance, and pedestrian types that can be restricted to specific areas. See the full Mobile Pedestrian System page.

They are genuinely modular. Each system runs on its own and can be imported separately — you can ship traffic first and add pedestrians later, or use only one, without touching the other’s code.

How the AI works

Both systems drive their agents along a waypoint network you lay out in the editor, not a NavMesh. That one decision is why the package behaves the way it does:

  • No NavMesh baking. Nothing to re-bake when you move a building, and no NavMesh agent budget to blow through. Vehicles follow lanes because lanes are what the waypoints describe — you get correct lane discipline for free instead of fighting a navigation mesh into behaving like a road.
  • Deterministic, debuggable paths. Every route is visible in the scene view. When a car does something odd you can see exactly which waypoint sent it there.
  • Pooling and reuse. Vehicles and pedestrians are recycled around the player rather than instantiated across the whole map, so density near the camera stays high while the total agent count stays low.
  • Jobs and Burst. The per-agent work runs on Unity’s Job System and is compiled with Burst, so a busy street is spread across cores instead of stacked on the main thread.
  • An API and an event system. Subscribe to events like OnVehicleActivated, OnDestinationReached and OnObstaclesUpdated, or take control directly with SetDestination, SetVehiclePath and the priority-override calls, when you want scripted behaviour on top of the ambient simulation.

What the traffic system does

  • Waypoint pathfinding with automatic lane selection
  • Overtaking and lane changing on multi-lane roads
  • Traffic lights, priority intersections, roundabouts and give-way junctions
  • Speed zones and per-vehicle-type road restrictions
  • Emergency vehicles — flag a car and surrounding traffic clears the way for it
  • Variable wheel counts, so bikes, cars, buses and trucks all work
  • Automatic headlights, brake lights, blinkers and engine sound
  • Custom editor tools for building and editing the road network

What the pedestrian system does

  • Grid-based waypoint pathfinding that scales to any scene size
  • Root-motion movement compatible with any humanoid character and animation set
  • Street crossing that respects the traffic lights the vehicles are using
  • Static and dynamic obstacle avoidance
  • Pedestrian types with per-area access restrictions
  • Custom waypoint events for scripted behaviour at specific points
  • Pooling and reutilisation for crowd density without the agent cost

How to add traffic and pedestrians to a Unity city

If you have a city scene and want it populated, the whole process takes about twenty minutes the first time. Here is the short version — the full documentation covers each step in detail.

1. Import the package

Import from the Package Manager into a Unity 2021.3 LTS or newer project. The package ships with an example city scene already wired up, so you can press Play and see a working simulation before you touch your own scene.

2. Draw the road network

Open the traffic system’s editor window and place waypoints along your roads. Lanes are separate waypoint chains, which is how the system knows what overtaking is allowed and where. If you already use a road tool, the geometry is usually there to snap to.

3. Set up the intersections

Mark each junction as a traffic light intersection, a priority intersection, a roundabout or a give-way. The light timings are configured on the intersection itself, and the pedestrian system reads the same lights, so crossings stay in sync with the cars automatically.

4. Lay the pedestrian grid and crossings

Pedestrian waypoints go on the pavements as a grid rather than as lanes, because pedestrians wander rather than commute. Connect the crossings to the intersections you just configured.

5. Assign prefabs and tune density

Drop your car and character prefabs into the pooling lists, set how many of each should exist around the player, and press Play. Density is the main performance dial — start low on a mobile target and raise it until the frame budget tells you to stop.

Video walkthroughs of every step are on the tutorials page.

Built mobile first, not scaled down to fit

Most city traffic assets are built for desktop and then trimmed for phones. This one started on mobile. The pooling system, the Burst-compiled agent updates and the waypoint approach all exist because the budget was a phone frame from the beginning — which means on desktop and console you have headroom to spend on density instead of on getting it to run at all.

It runs on any platform that supports the Burst compiler: Windows, macOS, Linux, Android and iOS.

Works with the road tools you already use

This package handles the AI, not the geometry. It is already compatible with EasyRoads3D, Cidy 3D and Road Constructor, so you can generate or model your city however you prefer and lay the waypoint network over the result. It works equally well on a hand-modelled block or an imported city mesh.

Free traffic scripts vs. a maintained system

There are good free waypoint traffic scripts on GitHub, and for a single straight road they are enough. The cost shows up later: intersection priority, giving way, overtaking without collisions, pedestrians that cross on the right light, and pooling that holds a frame rate on a phone are each a week of work, and they interact. Most projects that start from a free script rewrite it once and then abandon it.

If you would rather spend that time on your game, that is the trade this package is for. If you would rather build it yourself, the tutorial videos explain how the intersection and priority logic works — they are free to watch either way.

Should you buy the bundle or one system?

Buy the bundle if your scene needs both cars and people. At list price the two systems bought separately come to $238 — $129 for Mobile Traffic System plus $109 for Mobile Pedestrian System — against $219 for the bundle, so you save $19 against the cost of buying both individually. The integrated example scene, showing traffic and pedestrians sharing one road network, only ships with the bundle.

Buy one system on its own if you only need one: a racing or driving game usually needs traffic alone, and an on-foot game in a quiet setting usually needs pedestrians alone. Nothing is lost by starting with one — the systems are independent, and adding the other later is an import, not a migration.

All three go on sale regularly; the Asset Store always shows the current price.

Requirements

  • Unity 2021.3 LTS or newer
  • Any platform supporting the Burst compiler — Windows, macOS, Linux, Android, iOS
  • Complete commented C# source code included; nothing ships as a DLL
  • No third-party dependencies required

Frequently asked questions

Does it need NavMesh?

No. Both the traffic and the pedestrian system use their own waypoint pathfinding. There is nothing to bake, and no NavMesh agent limit to work around.

Which render pipeline does it support?

Built-in, URP and HDRP. The AI itself is renderer-agnostic — only the demo materials are pipeline-specific, and converting them is a standard material upgrade.

Will it run on mobile?

Yes — that is what it was designed for. Pooling keeps the active agent count low while density around the player stays high. Try the Android demo before you buy.

Can I buy just the traffic system or just the pedestrians?

Yes. Mobile Traffic System and Mobile Pedestrian System are sold separately and each works without the other. The bundle is the cheaper route if you want both.

Do I get the source code?

Yes — the complete, commented C# source. You can read it, change it and extend it. Nothing is locked in a DLL.

Does it work with EasyRoads3D or my own road tool?

Yes. It is already compatible with EasyRoads3D, Cidy 3D and Road Constructor, and because the waypoint network is laid out independently of the geometry it works over any road mesh, generated or hand-modelled.

Can I make cars chase or react to the player?

Emergency-vehicle behaviour is built in: flag a vehicle and the surrounding traffic clears the way. Chase or follow-the-player AI is not included out of the box, but the API is built for it — SetDestination, SetVehiclePath, waypoint queries, the priority-override calls and the behaviour-override delegates are all public.

How many cars and pedestrians can it handle?

Density is a setting, not a hard limit, and the honest answer depends on your target device and your prefab complexity. The pooling system means the number visible around the player matters far more than the size of your city. The PC and Android demos are the fastest way to judge it on hardware you care about.

Is there a demo?

Yes — playable PC and Android demos are linked at the top of this page.

What support is there?

Full written documentation, a video tutorial series, and a Discord where you can ask directly. Support is handled by the person who wrote the code.

Tutorials

Installation Tutorial

Intersection Setup

Want to get in touch?