Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Simple Traffic System

Discussion in 'Assets and Asset Store' started by Stephen_O, Dec 15, 2019.

  1. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    Version 1.0.20 is now available.
     
  2. jamiedspencer

    jamiedspencer

    Joined:
    Sep 28, 2015
    Posts:
    3
    Hi Stephen,
    Firstly loving the package. To anyone thinking about getting it, its fantastic and I was surprised how easy it is to get it up and running.
    Was looking at a different way of spawning vehicles. I want to spawn all vehicles from one end of a route at a certain rate (say 1 vehicle every 10 seconds). Was curious if anyone had done this before and any tips/ideas on how to do it.
    Thank you
    jamie
     
    Stephen_O likes this.
  3. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    Hi Jaime, thanks for the compliment. It always makes me feel good to hear positive feedback.

    You can use this script to spawn vehicles on a specific route's spawn point every x seconds:

    Code (CSharp):
    1. namespace TurnTheGameOn.SimpleTrafficSystem
    2. {
    3.     using UnityEngine;
    4.  
    5.     public class SpawnRandomFromPool : MonoBehaviour
    6.     {
    7.         public AITrafficSpawnPoint spawnPoint;
    8.         public bool spawnCars = true;
    9.         public float spawnRate = 10f;
    10.         private float timer;
    11.         private AITrafficWaypointRoute route;
    12.         private AITrafficCar spawnCar;
    13.         private Vector3 spawnPosition;
    14.         private Quaternion spawnRotation;
    15.         private Vector3 spawnOffset = new Vector3(0, -4, 0);
    16.         private Transform nextPoint;
    17.  
    18.         private void Start()
    19.         {
    20.             timer = 0f;
    21.             route = GetComponent<AITrafficWaypointRoute>();
    22.         }
    23.  
    24.         private void Update()
    25.         {
    26.             if (spawnCars)
    27.             {
    28.                 timer -= Time.deltaTime;
    29.                 if (timer <= 0f)
    30.                 {
    31.                     timer = spawnRate;
    32.                     spawnCar = AITrafficController.Instance.GetCarFromPool(route);
    33.                     if (spawnCar != null && spawnPoint.isTrigger == false)
    34.                     {
    35.                         spawnPosition = spawnPoint.transform.position + spawnOffset;
    36.                         spawnRotation = spawnPoint.transform.rotation;
    37.                         spawnCar.transform.SetPositionAndRotation(spawnPosition, spawnRotation);
    38.                         nextPoint = spawnPoint.waypoint.onReachWaypointSettings.nextPointInRoute.transform;
    39.                         spawnCar.transform.LookAt(nextPoint);
    40.                     }
    41.                 }
    42.             }
    43.         }
    44.  
    45.     }
    46. }
    Just attach it to the AITrafficWaypointRoute you want to use, and assign an AITrafficSpawnPoint from the route. Then make sure pooling is enabled (it only needs to be enabled at startup, you can disable it after traffic has spawned if this is your only spawn point), there needs to be enough cars in the pool for new cars to spawn.
     
  4. jamiedspencer

    jamiedspencer

    Joined:
    Sep 28, 2015
    Posts:
    3
    Wow....thank you so much Stephen, I just tried it out and it works like an absolute charm!!!
    Thank you for making such an incredible tool!
    and thank you also for getting back to me....excellent customer support!
    Thank you so much for being so amazing!!!
     
    Stephen_O likes this.
  5. thecoch

    thecoch

    Joined:
    May 14, 2017
    Posts:
    17
    hey, i‘m using version 1.0.20, i think there is a bug here.
    I wanna spawn vehicles from pool, so i checked "Random spawn from pool", and left "spawnTrafficVehicles" empty, then I hit the play button, some errors was threw in console,and no car was spawned.

    here is the screenshot.
    upload_2020-9-4_14-18-16.png
     
    Stephen_O likes this.
  6. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    That option on waypoint routes should be renamed to "Spawn From AITrafficController".

    For it to work, you need to populate the 'Traffic Prefabs' array on the AITrafficController. It will spawn car prefabs from the AITrafficController array instead of the waypoint route array.

    If you want to use the pooling system, populate the 'Traffic Prefabs' array, enable 'Use Pooling', and assign the 'Centert Point' on the AITrafficController.

    Sorry about the confusion, it will be renamed next update.
     
    Last edited: Sep 4, 2020
  7. thecoch

    thecoch

    Joined:
    May 14, 2017
    Posts:
    17
    I know what's going on here.
    I thought AITrafficWaypointRoute.SpawnTrafficVehicles is the prefabs to be spawned on this route, so I figured if I want to use the prefabs on AITrafficController, i just need to 1.leave this array empty and 2.check the 'randomSpawnFromPool'.
    but I was wrong, i have to set that array size to a non-zero number.
     
    Stephen_O likes this.
  8. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    Thanks for the feedback, I'll try to make that setting more intuitive as well.
     
  9. greatowq01

    greatowq01

    Joined:
    Dec 16, 2018
    Posts:
    37
    I am very interested in this asset.Can i use it in my project which is generating road at runtime procedually?like an endless racing game in a scene with endless straight roads and crossings.
     
  10. thecoch

    thecoch

    Joined:
    May 14, 2017
    Posts:
    17
    hello, how to set the parent of all spawned vehicles?
     
  11. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    I think it would be possible, though you'd obviously have to do some custom scripting to make it work as needed, I believe the API should be able to handle the following scenario:

    The AITrafficController caches all the routes and spawn points when it initializes, so those would need to be present i n your scene when it starts. One possible solution would be to create preconfigured route segments, enough to satisfy your custom pooling need. You'll have to script a system that would move around these cached segments and update the waypoint settings on each to connect to neighbors when placing them procedurally during runtime. You may also have to custom script moving the cars around as needed for the segments.
     
  12. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    U̶n̶f̶o̶r̶t̶u̶n̶a̶t̶e̶l̶y̶ ̶s̶e̶t̶t̶i̶n̶g̶ ̶a̶ ̶p̶a̶r̶e̶n̶t̶ ̶f̶o̶r̶ ̶t̶h̶e̶ ̶c̶a̶r̶s̶ ̶i̶s̶ ̶n̶o̶t̶ ̶s̶u̶p̶p̶o̶r̶t̶e̶d̶ ̶a̶t̶ ̶t̶h̶i̶s̶ ̶t̶i̶m̶e̶,̶ ̶i̶f̶ ̶t̶h̶i̶s̶ ̶i̶s̶ ̶s̶o̶m̶e̶t̶h̶i̶n̶g̶ ̶t̶h̶a̶t̶'̶s̶ ̶i̶m̶p̶o̶r̶t̶a̶n̶t̶ ̶t̶o̶ ̶y̶o̶u̶ ̶l̶e̶t̶ ̶m̶e̶ ̶k̶n̶o̶w̶ ̶a̶n̶d̶ ̶I̶ ̶c̶a̶n̶ ̶t̶r̶y̶ ̶t̶o̶ ̶w̶o̶r̶k̶ ̶o̶n̶ ̶a̶ ̶s̶o̶l̶u̶t̶i̶o̶n̶.̶

    I've found a solution, will be added next update.
     
    Last edited: Sep 6, 2020
  13. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    I've made some modifications, it's now possible to set a parent via toggle in the AITrafficController inspector. If the parent transform is not defined, the AITrafficController transform will be the parent.

    I'll submit this soon as update v1.0.21
     
  14. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    Version 1.0.21 submitted

    • Added AITrafficController.GetCarFromPool(AITrafficWaypointRoute, AITrafficVehicleType) method, this alternate method allows you to specify the type of car returned from the pool.
    • Added 'Set Car Parent' option to AITrafficController - NOTE: having the car objects under a parent will result in reduced perfiormance, this setting is only recommended for reducing hierarchy clutter with in editor testing.
    • Renamed AITrafficWaypointRoute.randomSpawnFromPool variable to spawnFromAITrafficController to better describe what it does. Updated tooltip description to be more clear on how it works.
     
  15. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    Version 1.0.22 is now available.
     
  16. thecoch

    thecoch

    Joined:
    May 14, 2017
    Posts:
    17
    great! thanks a lot!
     
  17. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    New tutorial for using a player car with STS:

     
  18. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    Version 1.0.22 is almost ready. With this update I've spent some time refactoring the variables and register logic to improve runtime API features. This update primarily allows spawning and registering new cars dynamically at runtime, as well as enabling/disabling AI processing on any car to allow for more customization. I'll be adding 2 new example scripts to demonstrate usage in the Scripts/Utility folder.

    Toggle Car AI Processing Example

    Code (CSharp):
    1. namespace TurnTheGameOn.SimpleTrafficSystem
    2. {
    3.     using UnityEngine;
    4.  
    5.     public class ToggleCarAIProcessing : MonoBehaviour
    6.     {
    7.         public AITrafficCar car;
    8.         public AITrafficWaypoint targetWaypoint;
    9.  
    10.         [ContextMenu("DisableAIProcessing")]
    11.         public void DisableAIProcessing()
    12.         {
    13.             car.DisableAIProcessing();
    14.         }
    15.  
    16.         [ContextMenu("EnableAIProcessing")]
    17.         public void EnableAIProcessing()
    18.         {
    19.             car.EnableAIProcessing();
    20.             car.ChangeToRouteWaypoint(targetWaypoint.onReachWaypointSettings);
    21.         }
    22.     }
    23. }
    Spawn And Register Car At Runtime Example

    Code (CSharp):
    1. namespace TurnTheGameOn.SimpleTrafficSystem
    2. {
    3.     using UnityEngine;
    4.  
    5.     public class RegisterCarRuntime : MonoBehaviour
    6.     {
    7.         public AITrafficCar aITrafficCarPrefab;
    8.         public AITrafficWaypointRoute aITrafficWaypointRoute;
    9.         public AITrafficSpawnPoint aITrafficSpawnPoint;
    10.         private AITrafficCar spawnedAITrafficCar;
    11.  
    12.         [ContextMenu("SpawnAndRegisterCar")]
    13.         public void SpawnAndRegisterCar()
    14.         {
    15.             if (aITrafficSpawnPoint.isTrigger == false)
    16.             {
    17.                 spawnedAITrafficCar = Instantiate(aITrafficCarPrefab.gameObject, aITrafficSpawnPoint.transform.position, aITrafficSpawnPoint.transform.rotation).GetComponent<AITrafficCar>();
    18.                 spawnedAITrafficCar.RegisterCar(aITrafficWaypointRoute);
    19.             }
    20.         }
    21.     }
    22. }
     
  19. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    Version 1.0.22 submitted

    **PLEASE NOTE**

    Collections is now required to be installed via the Package Manager

    • AITrafficController private data refactor; NatvieArrays were converted to NativeLists to better support adding new cars at runtime.
    • AITrafficCar.RegisterCar can now be called at runtime to support dynamically adding traffic cars
    • New function AITrafficCar.DisableAIProcessing
    • New function AITrafficCar.EnableAIProcessing
    • AITrafficCar an now be a child of other objects
    • Added 'Set Car Parent' option to AITrafficController, allowing you to define a transform as a parent or use the AITrafficController as a parent if undefined. Please note that having the car objects under a parent will result in reduced performance, this setting is only recommended for reducing hierarchy clutter with in editor testing.
     
    Last edited: Sep 12, 2020
  20. joeysipos

    joeysipos

    Joined:
    Jul 28, 2015
    Posts:
    41
    Hi Stephen, I am on the latest version of Unity 2019.4.9 and I can't place any waypoints on a plane with a collider. I added the AITrafficController and AITrafficWaypointRoute. I have the AITrafficWaypointRoute selected and then try to hit Shift + Left Click to add waypoints and all it does is (add) select the plane. What am I doing wrong. I followed your intro tutorial exactly the same.
    I am hoping to add waypoint onto a terrain eventually. I should be able to do this no?
     
  21. joeysipos

    joeysipos

    Joined:
    Jul 28, 2015
    Posts:
    41
    Stephen helped me solve this issue on Discord. I had to go to Window - layouts - reset factory default and now it works...
     
    Stephen_O likes this.
  22. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    Unfortunately this is a long standing Unity bug, that's never been fixed, and resolving it is only passed on through tribal knowledge. I've seen this happen in so many projects that I've lost count.

    Anytime an editor window or tool function does not work as expected, resetting the unity window layout to default will often fix the editor related bugs.
     
  23. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    Version 1.0.22 is now available.

    Note: Collections is now required to be installed via package manager.
     
    Last edited: Sep 14, 2020
  24. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    Version 1.0.23 submitted

    • Added stopTime variable to AITrafficWaypointSettings. Set stop time greater than 0 to restart the car after the stop time duration.
     
  25. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    Version 1.0.23 is now available.
     
  26. ZolnierGames

    ZolnierGames

    Joined:
    Feb 19, 2018
    Posts:
    87
    Collections is nowhere to be found in the package manager in the latest Unity releases now, rendering this resource inoperable. What do we do??
     
    Stephen_O likes this.
  27. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    Unity has been making some package related changes in the latest beta/tech release streams for 2020. Personally I've been hoping they would make it easier to use packages, not harder. My hope is that these packages are eventually auto installed.

    I recently made a recommended setup guide for current LTS, and will make a new one when 2020 LTS is available.

    2019 LTS Guide:



    For current 2020 versions, you'll need to do the following to import collections or any other unlisted packages:

    1. Edit > Project Settings > Package Manager
    2. Toggle on Enable Preview Packages
    3. Click I understand Popup
    PM Project Settings.jpg

    4. Window > Package Manager
    5. Click the drop-down menu (plus icon) on the top left of the window, and select add package from git URL…
    PM git url.jpg

    6. Enter: com.unity.collections
    7. Click Add
    PM Add Package.jpg
     
  28. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    Version 1.0.24 has been submitted.

    • Brake lights are now enabled when StopDriving is called.
    • StopDriving no longer sets car rigidbody to isKinematic.
    • Wheel processing is no longer disabled while the car is stopped.
     
  29. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    Version 1.0.24 is now available.
     
  30. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    Version 1.0.25 submitted.

    • Removed Resources folder, moved contents to Prefabs/Primary
    • Editor functions logic refactor to remove needing to use Resources.Load
    • Removed static class LaneChangeHelper, function was moved to Editor_STSWindow where it's used.
     
  31. hvillacruz

    hvillacruz

    Joined:
    Aug 15, 2018
    Posts:
    8
    how to install Collections (0.1.1) , im using mac UNITY
     
  32. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
  33. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    Version 1.0.25 is now available.
     
  34. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    Version 1.0.26 submitted.

    • Moved acceleration power setting from AITrafficController to AITrafficCar, AITrafficController can now have unique values for each car, values are set when car is registered.
     
  35. hvillacruz

    hvillacruz

    Joined:
    Aug 15, 2018
    Posts:
    8
    BuildFailedException: Burst compiler (1.3.6) failed running.
    when I try to build and save the application it's giving me this error
    I'm using MAC
     
  36. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    To use burst in on mac builds, you'll need to install the following:

    Xcode with command line tools installed (xcode-select --install)

    From Unity Docs: https://docs.unity3d.com/Packages/com.unity.burst@1.1/manual/index.html#standalone-player-support

    Each platform you target will have different build requirements.
     
  37. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    A new tutorial for stylized vehicles pack integration to match settings for current version.

     
  38. hvillacruz

    hvillacruz

    Joined:
    Aug 15, 2018
    Posts:
    8

    i installed xcode-select --install

    but still getting this error

    /bin/sh: /Users/randomUser/Library/PackageCache/com.unity.burst@1.3.6/.Runtime/hostlin/lld: cannot execute binary file
    Unhandled Exception:

    Burst.Compiler.IL.Aot.AotLinkerException: The native link step failed. Check previous exception in the log - linker command line : "/Users/RandomUser/Library/PackageCache/com.unity.burst@1.3.6/.Runtime/hostlin/lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 -sdk_version 10.9 -r -dylib -o "/Users/maybankpro2017/PakYouWorld/Suyop/Temp/Burst/burst-aotu0k9c1zm.dsk/lib_burst_generated.bundle" "/Users/maybankpro2017/PakYouWorld/Suyop/Library/PackageCache/com.unity.burst@1.3.6/.Runtime/libs/burstRTL_m64.a" "/Users/maybankpro2017/PakYouWorld/Suyop/Temp/Burst/burst-aotu0k9c1zm.dsk/lib_burst_generated_part_1.o" "/Users/maybankpro2017/PakYouWorld/Suyop/Temp/Burst/burst-aotu0k9c1zm.dsk/lib_burst_generated_part_3.o" "/Users/maybankpro2017/PakYouWorld/Suyop/Temp/Burst/burst-aotu0k9c1zm.dsk/lib_burst_generated_part_2.o" "/Users/maybankpro2017/PakYouWorld/Suyop/Temp/Burst/burst-aotu0k9c1zm.dsk/lib_burst_generated_part_0.o" "/Users/maybankpro2017/PakYouWorld/Suyop/Temp/Burst/burst-aotu0k9c1zm.dsk/lib_burst_generated_part_5.o" "/Users/maybankpro2017/PakYouWorld/Suyop/Temp/Burst/burst-aotu0k9c1zm.dsk/lib_burst_generated_part_7.o" "/Users/maybankpro2017/PakYouWorld/Suyop/Temp/Burst/burst-aotu0k9c1zm.dsk/lib_burst_generated_part_6.o" "/Users/maybankpro2017/PakYouWorld/Suyop/Temp/Burst/burst-aotu0k9c1zm.dsk/lib_burst_generated_part_4.o" "/Users/maybankpro2017/PakYouWorld/Suyop/Temp/Burst/burst-aotu0k9c1zm.dsk/lib_burst_generated_part_1_merged.o""
    at Burst.Compiler.IL.Aot.AotNativeLinkBase.RunNativeLinkerTool (System.String command, System.String arguments, System.String errorMessage, System.String commandType, System.String workingDirectory, System.Boolean muteOutputs) [0x000d0] in <9b99a8d26a5f43d4ad1097789969a537>:0
    at Burst.Compiler.IL.Aot.AotNativeLinkLLVMMacOS.Link (Burst.Backend.TargetCpu targetCpu, System.Collections.Generic.List`1[T] inputFiles, System.String outputFile, System.Boolean enableDebugInfo) [0x00118] in <9b99a8d26a5f43d4ad1097789969a537>:0
    at Burst.Compiler.IL.Aot.AotCompiler.Link (System.Collections.Generic.List`1[T] groups, System.String nameSuffix, Burst.Compiler.IL.Aot.AotCompilerOptions compilerOptions, System.IO.TextWriter consoleOut, System.IO.TextWriter consoleError) [0x001f8] in <9b99a8d26a5f43d4ad1097789969a537>:0
    at Burst.Bcl.BclApp+LibraryThread.Process (Burst.Bcl.BclApp+LibraryCompilationRequest libraryRequest) [0x00440] in <52cdf9e3a3c345ba8ab16cad75b48614>:0
    at Burst.Bcl.BclApp+LibraryThread.Run () [0x0001a] in <52cdf9e3a3c345ba8ab16cad75b48614>:0
    at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00014] in <fb001e01371b4adca20013e0ac763896>:0
    at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in <fb001e01371b4adca20013e0ac763896>:0
    at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <fb001e01371b4adca20013e0ac763896>:0
    at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in <fb001e01371b4adca20013e0ac763896>:0
    at System.Threading.ThreadHelper.ThreadStart () [0x00008] in <fb001e01371b4adca20013e0ac763896>:0
     
  39. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    Version 1.0.26 is now available.
     
  40. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    It sounds like there's some issue with building burst on a mac. Since Unity is building and maintaining the burst compiler you'd likely have better luck asking in their Burst for standalone players forum thread.
     
  41. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    Version 1.0.27 submitted.

    • Fixed inspector script error for AITrafficController Car Settings
     
  42. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    Version 1.0.27 is now available.
     
  43. Konyak

    Konyak

    Joined:
    Nov 21, 2019
    Posts:
    20
    It usually works well, but when the following error occurs, all cars lose control.
    The error occurs 50-200 times at once and then again after a while. I can't figure out what causing it.
    I use pooling, traffic lights, and yield triggers (without traffic lights).

    NullReferenceException: Object reference not set to an instance of an object.
    TurnTheGameOn.SimpleTrafficSystem.AITrafficController.FixedUpdate () (at Assets/TurnTheGameOn/SimpleTrafficSystem/Scripts/AITrafficController.cs:621)

    Also, if the car's max speed is higher than speed limit on the route, the brake lights flashing continuously.

    Sorry for my bad english.
     
    Last edited: Sep 26, 2020
  44. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    Hello, it looks like your errors/bugs are related to how you're using YieldTriggers, they're designed to be used with traffic lights (you can not use them without a traffic light).

    I do mention this in the YieldTriggers tutorial video, If you want to use YieldTriggers, please follow the tutorial video for more details on their setup and usage:



    I would suspect that using the YieldTriggers on routes without traffic lights is what's causing your cars to behave strangely. Also, the error is specifically is pointing to a waypoint with an empty YieldTriggers array field, you should check to make sure there are no empty YieldTrigger fields on your waypoints.
     
    Konyak likes this.
  45. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    Version 1.0.28 has been submitted.

    • Improved AITrafficWaypointRoute inspector.
    • AITrafficWaypointRoute 'Spawn From AITrafficController' option now reveals a 'Spawn Amount' value, used to define how many cars to spawn from AITrafficController prefab list. This will prevent user error from ambiguity when using this setting.
     
    Last edited: Sep 28, 2020
  46. Konyak

    Konyak

    Joined:
    Nov 21, 2019
    Posts:
    20
    Thanks for your answer, I'll rework it with traffic lights.

    The yield triggers usually works great even without lights, but sometimes this error occurs. So the error is not permanent, it caused by some event. Unfortunately, I couldn't figure it out. Maybe it has to do with the fact that OnTriggerExit doesn't run on cars going back to the pool?
     
  47. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    The error is pointing to a waypoint with an empty YieldTriggers array field, check to make sure there are no empty YieldTrigger array fields on your waypoints (if you have an unassigned YieldTrigger field it will cause an error).
    YTs.jpg
     
  48. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    Version 1.0.28 is now available.
     
  49. Konyak

    Konyak

    Joined:
    Nov 21, 2019
    Posts:
    20
    This 2 errors appears when I want to make a build:
    (Unity 2019.4.8f1, Burst 3.6.1, Collection 0.9.0)

    Assets\TurnTheGameOn\SimpleTrafficSystem\Scripts\AITrafficWaypointRouteCreator.cs(194,69): error CS1061: 'AITrafficWaypointRoute' does not contain a definition for 'ClickToSpawnNextWaypoint' and no accessible extension method 'ClickToSpawnNextWaypoint' accepting a first argument of type 'AITrafficWaypointRoute' could be found (are you missing a using directive or an assembly reference?)

    Assets\TurnTheGameOn\SimpleTrafficSystem\Scripts\AITrafficWaypointRouteCreator.cs(199,70): error CS1061: 'AITrafficWaypointRoute' does not contain a definition for 'ClickToSpawnNextWaypoint' and no accessible extension method 'ClickToSpawnNextWaypoint' accepting a first argument of type 'AITrafficWaypointRoute' could be found (are you missing a using directive or an assembly reference?)
     
  50. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    Those bugs were fixed a few months ago in an older version. I'm unable to reproduce this error when building with the latest version of the asset and same project setup as you.