Uploaded July 2022 | Updated September 2026, 2 hours ago
Learn how you can implement the jobs system to improve the performance of Line of Sight checking for your AI!
In this Unity Tutorial you'll see the comparisons of the typical ways you might see line of sight implemented:
1. EnemyLineOfSightChecker.cs attached to each Enemy (worst performance, most likely this is what you'd start with)
2. EnemyLineOfSightManager.cs - Checking Line of Sight for all Enemies in a single Update() loop (better performance, but can be improved)
3. EnemyLineOfSightManager.cs - Checking Line of Sight via the Jobs system (best performance for large numbers of enemies!)
In this tutorial repository, all 3 methods are available for you to compare on your hardware.
You'll see that the jobs system is not a magic bullet, it solves specific problems such as tasks that can be highly parallelized. You can also use this to determine at which points the parallelization is more helpful than harmful (or just unnecessarily adds code complexity)!
As usual with the AI Series, we're using the NavMesh Components: docs.unity3d.com/Manual/NavMesh-BuildingComponents.html not the built-in navigation system.
🔶 ALL THINGS LlamAcademy now available at: https://llamacademy.dev/support including latest tutorials, courses, ways to support, and more! Check it out 🙂
👨💻 Get the FULL FREE PROJECT on GitHub: github.com/llamacademy/ai-series-part-40
🏷️Save 25% on the ultimate C# IDE: JetBrains Rider with code LLAMACADEMY: jetbrains.com/store/?section=personal&billing=yearly
📚 Resources:
🟠 Jobs System Manual: docs.unity3d.com/Manual/JobSystemOverview.html
🟠 Spherecast Command: docs.unity3d.com/ScriptReference/SpherecastCommand.html
🟠 Allocator Types: docs.unity3d.com/Manual/JobSystemNativeContainer.html
🟠 Unity Performance: docs.unity3d.com/Manual/BestPracticeUnderstandingPerformanceInUnity8.html
Some links may be affiliate links, which at no additional cost to you, gives me a small portion of the purchase.
Chapters:
00:00 Topic Introduction
03:28 Scene Overview
04:26 How you'd probably implement it (no jobs) - EnemyLineOfSightManager.cs
06:23 Jobs System Implementation (with explanations) - EnemyLineOfSightManager.cs
11:10 Performance Comparison - Inspecting Performance Without Jobs
12:10 Performance Comparison - With Jobs
15:03 Performance Considerations & Final Thoughts
Learn how you can implement the jobs system to improve the performance of Line of Sight checking for your AI!
In this Unity Tutorial you'll see the comparisons of the typical ways you might see line of sight implemented:
1. EnemyLineOfSightChecker.cs attached to each Enemy (worst performance, most likely this is what you'd start with)
2. EnemyLineOfSightManager.cs - Checking Line of Sight for all Enemies in a single Update() loop (better performance, but can be improved)
3. EnemyLineOfSightManager.cs - Checking Line of Sight via the Jobs system (best performance for large numbers of enemies!)
In this tutorial repository, all 3 methods are available for you to compare on your hardware.
You'll see that the jobs system is not a magic bullet, it solves specific problems such as tasks that can be highly parallelized. You can also use this to determine at which points the parallelization is more helpful than harmful (or just unnecessarily adds code complexity)!
As usual with the AI Series, we're using the NavMesh Components: docs.unity3d.com/Manual/NavMesh-BuildingComponents.html not the built-in navigation system.
🔶 ALL THINGS LlamAcademy now available at: https://llamacademy.dev/support including latest tutorials, courses, ways to support, and more! Check it out 🙂
👨💻 Get the FULL FREE PROJECT on GitHub: github.com/llamacademy/ai-series-part-40
🏷️Save 25% on the ultimate C# IDE: JetBrains Rider with code LLAMACADEMY: jetbrains.com/store/?section=personal&billing=yearly
📚 Resources:
🟠 Jobs System Manual: docs.unity3d.com/Manual/JobSystemOverview.html
🟠 Spherecast Command: docs.unity3d.com/ScriptReference/SpherecastCommand.html
🟠 Allocator Types: docs.unity3d.com/Manual/JobSystemNativeContainer.html
🟠 Unity Performance: docs.unity3d.com/Manual/BestPracticeUnderstandingPerformanceInUnity8.html
Some links may be affiliate links, which at no additional cost to you, gives me a small portion of the purchase.
Chapters:
00:00 Topic Introduction
03:28 Scene Overview
04:26 How you'd probably implement it (no jobs) - EnemyLineOfSightManager.cs
06:23 Jobs System Implementation (with explanations) - EnemyLineOfSightManager.cs
11:10 Performance Comparison - Inspecting Performance Without Jobs
12:10 Performance Comparison - With Jobs
15:03 Performance Considerations & Final Thoughts










