Navigation
Quick Start
Project Structure
Car Manager
Track Generator
Powerups
Game Systems
Levels
Car AI
Customization
Support
Car Handling
Wheel Rush uses a dynamic car handling system that allows the same car prefab to function either as a player-controlled car or an AI-controlled car. This is all managed by the CarTypeHandler script.
How the System Works
Each car in the game is defined by a CarTemplateSO (ScriptableObject) which contains:
- The car’s base stats
- The car’s visuals (prefab reference)
- Handling values
- Speed and acceleration values
- Additional configuration
When a car is spawned—either by the player or the AI—the CarTypeHandler performs the following steps:
- Load the car prefab from the CarTemplateSO
- Instantiate the shared prefab
- Determine the car’s role (Player or AI)
- Add or remove components dynamically:
- Player input scripts
- AI driving scripts
- Handling controllers
- Camera target components (player only)
- Any systems specific to the role
This means you don’t need separate prefabs for player and AI cars.
One prefab → two behaviors.
This makes the entire car workflow:
- Cleaner
- Easier to maintain
- Easier to expand
- Consistent across all cars
Why This System Matters
- One source of truth: Any visual or stat update to a car affects both AI and player automatically.
- Guaranteed consistency: You never get desynced prefabs or mismatched versions.
- Faster workflow: Adding a new car only requires valid data in the ScriptableObject—CarTypeHandler handles the rest.