Unity traffic system: AI cars stopped at a red light on a city crossing, with more traffic queueing across the junction

Mobile Traffic System — the Unity traffic system built for phones

300 AI cars on a phone. Waypoint pathfinding, no NavMesh, complete C# source.

Mobile Traffic System is a Unity traffic system that fills your roads with AI cars that overtake, change lanes, obey traffic lights, negotiate roundabouts and give way properly at junctions — without a NavMesh, and without a frame budget you can’t afford. It runs 300 AI cars on a phone. Everything about its design follows from that.

Nominated for Best Development Tool at the Unity Awards 2021, and rated 4.8/5 from 65 ratings on the Unity Asset Store — more reviews than any competing Unity traffic asset.

Built for mobile, which changes the design

Most Unity traffic systems are written for desktop and then trimmed down for phones. This one went the other way, and 300 cars on a mobile device is the result rather than the marketing.

Vehicles are pooled and recycled around the player instead of instantiated across the whole map, so the cars you can see are the cars you pay for. The per-vehicle work runs on Unity’s Job System and is compiled with Burst, spreading a busy street across cores instead of stacking it on the main thread. Cars ship with LODs and there are hard-shadow options for low-end hardware.

The practical result is that density is a dial rather than a wall — and on desktop and console you spend the headroom on more traffic instead of on making it run at all. The Android demo is the fastest way to judge it on hardware you care about.

How the traffic AI works

Cars drive a waypoint network you lay out in the editor, not a NavMesh. That is the decision everything else follows from:

  • No NavMesh baking. Nothing to re-bake when a building moves, and no agent budget to exhaust. Lanes are waypoint chains, so lane discipline is a property of the road rather than something you fight a navigation mesh to fake.
  • Debuggable routes. Every path is visible in the scene view, and a runtime debug window shows what each car is deciding. When one behaves oddly you can see which waypoint sent it there.
  • Shortest-path queries. The system finds the shortest route between any two waypoints on the existing network, so scripted journeys use the same roads as ambient traffic.
  • An API and events. Subscribe to waypoint and vehicle events, override behaviour per car, or take direct control — the ambient simulation is the default, not a cage.

What the cars actually do

Driving behaviour

  • Automatic overtaking and lane changing wherever the road has multiple lanes
  • Narrow-road handling, where two cars cannot pass at once
  • Speed routes — different limits on different stretches
  • Car type restrictions, so buses stay off the alleys and trucks off the pedestrian streets
  • Building and static obstacle avoidance
  • Emergency vehicles: flag a car and surrounding traffic clears the way for it

Intersections and junctions

  • Traffic light intersections with configurable timings
  • Priority intersections and priority waypoints
  • Roundabouts
  • Complex Give Way for awkward multi-road junctions
  • Zipper-style give way where two roads converge into one

Vehicles

  • Trucks with trailers, articulated and handled properly through turns
  • Variable wheel counts, so bikes, cars, buses and multi-axle trucks all work
  • Automatic lighting: headlights, brake lights, blinkers and reverse lights
  • Engine and horn sound support
  • Hard shadow options for cheaper rendering on low-end devices
  • Automatic car assignment across the network, or manual vehicle routes when you want a specific car on a specific road

Control and extension

  • Complete commented C# source — nothing ships as a DLL
  • Behaviour override hooks to replace any decision with your own
  • Custom waypoint events to trigger game logic at specific points
  • Left-hand and right-hand traffic, switchable across the whole network
  • A player component, so your car is seen and reacted to by the AI
  • Custom editor tools and a runtime debug window

Package Content

All that you see in the demo is included inside the package:

  • 1 mobile production ready car with 3 LODs and changeable colors, thanks to PolyNinja
  • 9 road tiles that can be assembled in any way to create complex roads.
  • 20 simple city buildings to populate your environment.
  • 1 demo scene that assembles all the above elements into the playable scene from the demo.

Additional Content

If you need additional traffic cars this asset is the best option:

GRIDLOCK – City Traffic Vehicle Pack

  • 7 low poly various cars and trucks models, exteriors only, with 3 LODs
  • Ready for easy implementation with the traffic system, containing all the required elements, such as, blinkers, lights, all optimized for maximum performance
  • Non overlapping, non mirrored, fully unwrapped UVs, with 2 different PBR material styles, for each vehicle, and easy to change colors , with all the corresponding textures

Trucks available here

Mobile Traffic Truck

  • Designed to be compatible with the Mobile Traffic System, this pack is optimized to run on mobile devices, as well as PC, while compromising as little as possible on the visual side of things, using LODs.
  • Create variety in your game with customizable paint materials that are masked, and 2 different skin options for each of the semi-truck components.
  • Ready-to-go prefabs, with all the lights and turn signals required.
  • Game game-ready hangar scene is included, which can be used as a garage.

How to add AI traffic to a Unity scene

From a road mesh to moving cars is about twenty minutes the first time. The documentation covers each step properly; this is the shape of it.

1. Import and run the demo

Import into a Unity 2021.3 LTS or newer project. A complete demo scene is included, so you can press Play and watch a working Unity traffic system before touching your own scene.

2. Lay the waypoint network

Open the editor window and place waypoints along your roads. Each lane is its own chain — that is how the system knows where overtaking is legal and which side of the road a car belongs on.

3. Configure the junctions

Mark each junction as a traffic light intersection, a priority intersection, a roundabout, a give-way or a zipper merge. Light timings live on the intersection itself.

4. Add your cars

Assign your vehicle prefabs, set wheel counts and any car type restrictions, and let the system handle lights, blinkers and sound. Prefabs from most vehicle packs work with a small amount of setup.

5. Tune density and profile

Set how many cars should exist around the player and press Play. Density is the main performance dial — start conservative on a mobile target and raise it until the frame budget objects.

There are step-by-step video walkthroughs for all of this on the tutorials page.

Works with the road tools you already use

This asset provides the AI, not the geometry. It is already compatible with EasyRoads3D, Cidy 3D and Road Constructor, and because the waypoint network is laid out independently of the mesh it works over generated roads, modelled roads or an imported city.

Who it’s for

Driving and racing games, open-world and city games, delivery and simulation games — anything where the roads need to feel used rather than empty. It is the right choice when you are shipping to phones, because that is the budget it was written against, and it stays the right choice on desktop and console where the same design simply buys you more cars.

If you would rather build it yourself, that is a legitimate choice; the tutorial videos explain how the intersection and give-way logic works and they are free to watch either way. What tends to surprise people is the order of the work: getting cars to follow a road takes an afternoon, and intersection priority, clean overtaking and pooling that holds a frame rate take considerably longer.

If your scene needs people as well as cars, the Mobile Pedestrian System shares the same traffic lights and crossings, and the Complete City Traffic & Pedestrian System bundles both for less than buying them separately.

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

How many cars can it run?

300 AI cars on a mobile device. Because vehicles are pooled around the player, the size of your city matters far less than how many cars are visible at once, and desktop and console have considerably more headroom. Your own figure will depend on prefab complexity — the Android and PC demos are the fastest way to judge it on your target hardware.

Does it need NavMesh?

No. Cars drive a waypoint network you lay out yourself. There is nothing to bake and no NavMesh agent limit to work around.

Will it run on mobile?

Yes — that is the design brief, not an afterthought. Pooling, the Job System and Burst, LOD-ready vehicles and hard-shadow options all exist because the original budget was a phone frame.

Which render pipeline does it support?

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

Does it support trucks with trailers?

Yes, articulated trailers are handled through turns and junctions. Wheel counts are configurable, so bikes, cars, buses and multi-axle trucks all work.

Can I use my own car models?

Yes. Assign your prefabs and configure the wheels; lights, blinkers and sound are driven by the system. The included car and the compatible vehicle packs are a starting point, not a requirement.

Left-hand or right-hand traffic?

Both, switchable across the whole network.

Can the AI react to the player’s car?

Yes — a player component makes your vehicle visible to the traffic, so cars brake and give way for you. Emergency-vehicle behaviour is built in. Chase or pursuit AI isn’t included out of the box, but the API, waypoint queries and behaviour-override hooks are public and built for it.

Does it work with EasyRoads3D or my own road tool?

Yes. It is already compatible with EasyRoads3D, Cidy 3D and Road Constructor, and the waypoint network is independent of the road mesh, so any geometry works.

Do I get the source code?

Yes — the complete, commented C# source. You can read it, change it and extend it.

Is it still being updated?

Yes. It has been maintained continuously since 2021 and updates ship regularly on the Asset Store.

Tutorials

Install and test

Prepare scene

Create basic road

Test traffic

Connect roads

Priority intersection

Traffic lights intersection

Narrow roads

Roundabout setup

Highway exit setup

Speed routes

Vehicle routes setup

Waypoint setup window

Car implementation

Traffic component & car pools

Scripting methods

Debug window

Custom Behaviours

Documentation, demos and support

Read the documentation · Watch the tutorial series · Add matching trucks · Add pedestrians

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

Get Mobile Traffic System on the Unity Asset Store

Want to get in touch?