The funny thing is, I've been trying to learn how to use the Jobs system via implementing it into the LOS system I had and failed miserably because I didn't know the caveats of needing unmanaged resources lmao ---- Then this video popped up!
Great job, there is not a lot videos about threads and jobs in unity. It would be nice if you could create follow up with more examples associated with this topic
In general in programming you should avoid constantly looking up indexes, where you do AliveEnemies[i] several times instead create a local variable like var aliveEnemy = AliveEnemies[i], then use aliveEnemy in your code, It may not sound like it'd make much of a difference but at scale or depending on how threading is handled it can make a significant performance impact, you can further optimize be avoiding using .Count or .Length in every loop iteration, by having a local variable like count = AliveEnemies.Count, and using that in your for loop args instead
This is a great example of jobs system but you can enable burst mode to even boost its performance to next level. What do you say about burst mode use case ?
I have not used burst specifically, but I do see a lot of people get some good performance benefits on top of jobs with it. So far I haven't tried to do anything so stressful that just job-ifying it didn't solve. Someone on reddit the other day was doing some stuff with Jobs + Burst and got some cool results for some computer simulation they were doing.
The SpherecastCommand is already "jobified" so the ScheduleBatch() call goes across the available threads. I think you can further optimize this by doing the setup of the commands in an IJob to decrease the amount of time spent on the main thread preparing the jobs.
for some reason the enemy always spot the player... no meter what layermask i set... if i put a wall between the enemy and player what layer should i set it to make the enemy ignore the player?
I think I'd need a little more information. Usually when that happens either the layer mask set up for the spherecast is not properly configured, the objects to be hit are not on the right layer, or they do not have valid colliders.
@@LlamAcademy still can't get it to work. the layer mask i set in the script, what they should be? the walls that block the sight? the player collider?
The funny thing is, I've been trying to learn how to use the Jobs system via implementing it into the LOS system I had and failed miserably because I didn't know the caveats of needing unmanaged resources lmao ---- Then this video popped up!
I've been getting into the Jobs system lately and it's wonderful, I had no idea that it had ray/spherecast compatibility. Thanks for the vid!
Awesome 😎 glad it could help!
Oh super😍 Good afternnon , Have a nice day ahead
Nice work explaining this!
Thanks 🧡!
Great content! I didn't even know that there is a device for multithreaded sphere casting like sphere cast command!
🙏
You could create all the SpherecastCommands inside a IJobParallelFor rather than on the main thread and that should improve performance even further.
Great idea! I remember I was struggling to use that in my game for some reason I don’t remember now, but for this use case, absolutely applicable!
This is a great video. Taking common expensive gameplay actions and job'iying them
🙏I appreciate that
Great job, there is not a lot videos about threads and jobs in unity. It would be nice if you could create follow up with more examples associated with this topic
Thanks! I will definitely add more Jobs system tutorials to the list of topics to cover!
In general in programming you should avoid constantly looking up indexes, where you do AliveEnemies[i] several times instead create a local variable like var aliveEnemy = AliveEnemies[i], then use aliveEnemy in your code, It may not sound like it'd make much of a difference but at scale or depending on how threading is handled it can make a significant performance impact, you can further optimize be avoiding using .Count or .Length in every loop iteration, by having a local variable like count = AliveEnemies.Count, and using that in your for loop args instead
nice man, we need more soft like this
can you make an example that isnt revolving around just the player/accounts for other entities? this is cool
Can this be used with OverlapSpheres? I'm still having a hard time understanding the Jobs system
Yup: docs.unity3d.com/ScriptReference/OverlapSphereCommand.html
i'm at the third video of this very good serie.. i'm a bit late but the subject is not an easy one
This is a great example of jobs system but you can enable burst mode to even boost its performance to next level. What do you say about burst mode use case ?
I have not used burst specifically, but I do see a lot of people get some good performance benefits on top of jobs with it. So far I haven't tried to do anything so stressful that just job-ifying it didn't solve. Someone on reddit the other day was doing some stuff with Jobs + Burst and got some cool results for some computer simulation they were doing.
@@LlamAcademy Try to explore when you have got time :)
Your content is superb :)
Curious, was there any reason why the jobs were done in method instead of a struct with IJob or other interface?
The SpherecastCommand is already "jobified" so the ScheduleBatch() call goes across the available threads. I think you can further optimize this by doing the setup of the commands in an IJob to decrease the amount of time spent on the main thread preparing the jobs.
Hi! is there a way to create navmeshes for AR? or would you recommend a different tool for that?
I haven’t specifically worked with AR and NavMeshes, but you can build a navmesh on any 3D topology, so I don’t see why not.
for some reason the enemy always spot the player... no meter what layermask i set... if i put a wall between the enemy and player what layer should i set it to make the enemy ignore the player?
I think I'd need a little more information. Usually when that happens either the layer mask set up for the spherecast is not properly configured, the objects to be hit are not on the right layer, or they do not have valid colliders.
@@LlamAcademy still can't get it to work. the layer mask i set in the script, what they should be? the walls that block the sight? the player collider?
Will start to learn it tomorrow, lets be patient pips! Godbless us haha
Ez profit bro, can you make opensea bid bot please?
Aye mucca
Sa
Sae