🚗
Playable Vehicle AI
🚗
Playable Vehicle AI
  • 🏡Home
  • ⭐Quick Start
  • 🚗Create cars
  • ↗️Waypoints
  • 🔀Waypoint Groups
  • ➕Spawn / Unspawn
  • 🚦Traffic Light
  • 🛑Priority Stop
  • 🚓Police
  • 👨‍🦱Player / Car Manager
  • 💥Integrations
  • 🆙Use in your code
  • Support
  • Discord
Powered by GitBook
On this page
  • The Spawner
  • The Unspawner

Spawn / Unspawn

The Spawner

Each waypoint can be turned into a Spawner by clicking on the Is Spawner parameter.

The purpose of the spawner is to spawn the cars of your traffic system at runtime.

The spawner spawns cars when it is hidden from the main camera.

Here is a list of the parameters:

  • Car Prefabs: A list of prefabs that represent the cars you want to spawn

  • Car Tag: the tag of the car GameObjects

  • Max Distance To Spawn: The maximum distance from the camera to spawn cars

  • Min Distance To Spawn: The minimum distance from the camera to spawn cars

  • Spawn Interval: the time interval at which cars will be spawned

  • Check Free Spawner Radius: a radius around the spawner to check if this space already contains cars (if it does, the car will not be spawned)

The Unspawner

The Unspawn script must be placed on the object to be destroyed (the car)

Its purpose is to destroy the car when it is no longer seen from the main camera.

Here is a list of the parameters:

  • Unspawn Delay: The delay after which the object will be destroyed

  • Allow Unspawn Min Radius: The distance the object must be from the camera to be destroyed.

Last updated 4 months ago

➕