Quick Start

Initial Components

  1. Create a new scene.

  2. In the Unity toolbar open:

    Spirit604/CityEditor/Create/City Base

    _images/CityBase.png
  3. This window appears for the first time:

    _images/CityBase2.png
  4. Select Hub or Hub Base according to your needs (in most cases Hub Base will be suitable for you if you don’t need sample scripts (built-in player, UI, camera, etc))

  5. Description:
    • Hub : root prefab used in Demo & Demo Mono scenes & contains demo sample dependencies.

    • Hub Base : clean root prefab with just traffic & pedestrian simulation without any extra stuff (player should be spawned with your own script or simply drag & drop into the scene).

  6. Press Create button.

  7. Continue with the Hub Base or Hub article, depending on your choice.

Hub Base

  1. Initial scene example:

    _images/ExampleScene2.png
  2. By default, the Cull point is automatically generated as a child of the main camera.

  3. If you want to add your own player that interacts with traffic, read here [optional step].

  4. The next step is to configure Scene

Scene

  1. Add Road segments to the scene (Use Ctrl+D to duplicate and Caps Lock to rotate).

    _images/Tutorial1.gif
  2. In the Road Parent press Force connect segments button.

    _images/Tutorial2.gif
  3. Create & connect Pedestrian nodes using the Pedestrian Node Creator (W hotkey to select node, E hotkey to connect nodes) or tick on Connect crosswalk option in the Road Parent & press Force connect segments button again (Use Tab and E hotkeys to place new nodes)

    _images/Tutorial3.gif
  4. In the Road Parent press Bake Path Data button (should be done after each road edit & before starting the scene) & select Hub object on the scene & generate a subscene.

    _images/Tutorial4.gif
  5. For more information on how to create a road, read the Road Network Workflow.

  6. Create a ground, if missing (GlobalSurfaceCollider example prefab) & set the layer for your ground surfaces to Ground (18) & layer for your static objects to StaticPhysicsShape (22) (read more about PhysicsShapeTransfer service, if you are going to use DOTS only). For DOTS cars, the ground surface should be on a sub-scene. For mono cars, the ground surface should be on the main scene.

    _images/Tutorial5.gif
  7. If you plan to use Hybrid Mono vehicles, set the World simulation type to Hybrid mono in the General settings config [optional step].

  8. Create your own traffic vehicles or temporarily use the built-in traffic already added [optional step].

  9. If you have created your own traffic, make sure the raycasting layer matches your ground collider layer (traffic prefabs can be found in TrafficCarEntityPoolBakerRef at the scene).

  10. Create your own pedestrians or temporarily use the built-in pedestrians already added [optional step].

  11. In the Cull config, adjust culling distance at which road objects, traffic, pedestrians etc. will be activated & use Cull debug to view culling states [optional step].

  12. In the Traffic settings, disable Cull physics if you don’t want cars to disable their physics when they’re far away [optional step].

  13. Add & customize game sounds [optional step].

  14. By default, the Unity.Entities is not rendered on the Sceneview, to fix this follow these steps:
    1. In the Unity editor toolbar select:

      Edit/Preferences

    2. Select the Entities tab.

    3. Set Scene view mode to Runtime Data.

      _images/EntitiesDisplay.png
  15. Launch the scene.

    _images/Tutorial7.gif

    Result example.

Demo Scene

  1. In the Project Folder view, select the following scene:

    DotsCity/Samples/Demo City/Scenes/Demo

  2. Press Play button.

  3. Read more about Project Scenes & Scene Structure.

Demo Mono Scene

  1. In the Project Folder view, select the following scene:

    DotsCity/Samples/Demo City/Scenes/Demo Mono

  2. Press Play button.

  3. Read more about Project Scenes & Scene Structure.