Fantastic City Generator

How To Use

  1. Buy & download, import the following asset plugin:

Getting Started

  1. Add the FCG scripting define to the Player Settings of the project.

  2. Open your scene.

  3. Create City base, in the Unity toolbar open:

    Spirit604/CityEditor/Create/City Base

  4. Create a new game object & add FCGSceneGenerator component.

  5. Generate a new config:

    _images/fcg1.png
  6. Set the World simulation type to Hybrid mono in the General settings config.

  7. Find the HybridTrafficCarMonoSkinBase Arcade prefab & set the ground layer to Default.

  8. Open the folder where the FCG traffic light prefabs are stored.

    _images/fcg1_2.png
  9. Open each prefab in the prefab stage & add the FCGTrafficLightConverter component & press the Create button.

    _images/fcg1_3.png
  10. Remove or disable built-in traffic system.

    _images/fcg10.png
  11. Import FCG templates.

    _images/fcg11.png
  12. Select Import template road blocks mode in the inspector.

    _images/fcg12.png
  13. Drag & drop all FCG prefabs

  14. Select Template container from the list

  15. Press Generate button

    _images/fcg13.png

    Example

  16. Select mode type depending on your needs.

Editor Mode

Road segments are connected with pregenerated prefab blocks in the Editor.

  1. Switch to Connect Editor Blocks mode in FCG Scene Generator

  2. Press Generate button

Runtime Mode

  1. Add the RUNTIME_ROAD scripting define to the Player Settings of the project.

  2. After the generation of Runtime Blocks is finished, add a new gameobject & add a RuntimeRoadManager component.

  3. Replace the code in RunTimeSample.cs with the GenerateCityAtRuntime method:

    public void GenerateCityAtRuntime(int citySize)
    {
            ObjectUtils.FindObjectOfType<RuntimeRoadManager>().RegenerateGraphAsync(() =>
            {
                    generator = cg.GetComponent<CityGenerator>();
    
                    generator.GenerateCity(citySize, false, false); // (city size:  1 , 2, 3 or 4)
            });
    }