Watch this if you've never tried JOBS in Unity (Tutorial)

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ก.ค. 2024
  • Show your Support & Get Exclusive Benefits on Patreon (Including Access to this tutorial Source Files + Code) - / sasquatchbgames
    Join our Discord Community! - / discord
    --
    JOBS are incredibly easy to schedule and can double (or sometimes more) your FPS depending on your use case. This system allows you to code safe-multi-threaded code for your games.
    I hope you enjoy!
    --
    Timestamps:
    00:00 - Introduction
    00:21 - Scene explanation
    01:03 - optimizing the enemy movement into a manager
    02:28 - JOBS explanation and setup
    03:36 - Setting up the JOBS struct
    06:51 - Scheduling a JOB
    08:33 - Using IJob and getting data from Job
    ---
    In need of more Unity Assets? Using our affiliate link is a great way to support us. We get a small cut that helps keep us up and running: assetstore.unity.com/?aid=110...
    ---
    Looking for some awesome Gamedev merch? - sasquatchbgames.myspreadshop....
    ---
    Who We Are-------------------------------------
    If you're new to our channel, we're Brandon & Nikki from Sasquatch B Studios. We sold our house to start our game studio, and work full time on building our business and making our game, Samurado.
    Don't forget to Subscribe for NEW game dev videos every Monday & Thursday!
    Wishlist Samurado!
    store.steampowered.com/app/23...
    Follow us on Twitter for regular updates!
    / sasquatchbgames
    #unitytutorial #unity2d #unity3d
  • เกม

ความคิดเห็น • 25

  • @naolshow
    @naolshow หลายเดือนก่อน +9

    The overhead at the end is not from job side, you are not disposing the rotation native array.
    And also you should not allocate and dispose the arrays each time since you are using the Persistent allocator, so either keep their reference by creating them at awake and disposing them in on destroy or simply allocate them and dispose them in update with a temporary allocator.

  • @majin2909
    @majin2909 หลายเดือนก่อน +4

    I know you since 1k subs, I am glad u didn't gave up and are that far on youtube, hope you are making a good living now, at least good enough to survive

  • @RobLang
    @RobLang หลายเดือนก่อน +2

    Really cool overview. Really appreciated the look at 15,000 individual jobs because I think the overhead would catch many out!

  • @TheArghnono
    @TheArghnono หลายเดือนก่อน +1

    Excellent tutorial!

  • @b5fan504
    @b5fan504 หลายเดือนก่อน

    A good video. I suspect some people may benefit from clarity that, essentially, every time you say 'thread' you could say 'core'. That's what you're allowing here; to spread more work across more CPU cores. I also like that you touched on their being no free lunch; it comes with its own overhead as everything does.

  • @user-uk9er5vw4c
    @user-uk9er5vw4c หลายเดือนก่อน

    nice content, thanks!

  • @AliHosseiniDev
    @AliHosseiniDev หลายเดือนก่อน

    Oh boi that was a nice explanation.

  • @danielwertz8724
    @danielwertz8724 หลายเดือนก่อน

    Im a godot developer but love your videos. Feel like i still got a little out of it. Helps that I use c# in my day job and use threading frequently. Thanks for the vid!

  • @janseenvideogaming
    @janseenvideogaming หลายเดือนก่อน

    Okay.. Im going to give this another shot. I need to start showing viewers how to make cool games and get more viewers. tough. Great video man

  • @OIndieGabo
    @OIndieGabo หลายเดือนก่อน

    Just to add my take on "why 2 libraries for Jobs exist" and also why we keep seeing libraries (namespaces) with the same name.
    I am not sure if this is exactly the case but the JOBS library is an isolated solution. It might not necesserally been written to work solely for the UnityEngine. It is a solution on multithreading in a specific scenario. So you have the solution "Unity/Jobs" (using slashs so youtube does not mistake it with a link). It contains everything to make Jobs work.
    And then you need an implematation that actually takes advantage of that system and applies its usage in the way it needs to its own solution. That's why you have the "UnityEngine/Jobs".
    It is basically the UnityEngine having an implementation on how to use the Jobs library, wich happens to be made by Unity (the company).

  • @user-rm2pj9jf8s
    @user-rm2pj9jf8s หลายเดือนก่อน

    I love it

  • @PhiLudo
    @PhiLudo หลายเดือนก่อน

    cool stuff

  • @Dragoncro0wn
    @Dragoncro0wn หลายเดือนก่อน +1

    Is it a bad idea to make the thread function like an update loop? Always running in the background doing its own tasks

  • @privatdetektivenkant5975
    @privatdetektivenkant5975 หลายเดือนก่อน +1

    Give me more!!!!!

  • @k-6353
    @k-6353 27 วันที่ผ่านมา

    Hi, I've seen JOB system when I started using Unity but i thought it was way too advance for me (i still do). All in all, Does this mean i cant implement JOB system into AI bots? or is there another way to optimize? Currently, I reach 20fps after spawning nearly 100 AI bots, equipped with Movement(patrol, chase many more), Combat etc.
    I get 15 fps with 350+ bots with their main AI script disabled.
    Would be greatly helpful if someone could lead me into a direction

  • @redragon1229
    @redragon1229 หลายเดือนก่อน

    Cool video. I want to point out that although the ~x2 boost in your example does not look that impressive, actually, excluding rendering and other processes, Jobs can be HUNDREDS of times faster than the same single-threaded calculations. In this example the difference is not so significant because, I think, most of the performance hit is the rendering.
    Also, as @naolshow pointed out: this can be further optimized.

  • @rrainix
    @rrainix 13 วันที่ผ่านมา

    How are you instaniating 15 thousand enemies so fast?

  • @Coco-gg5vp
    @Coco-gg5vp หลายเดือนก่อน

    First

  • @frankrenzulli4354
    @frankrenzulli4354 29 วันที่ผ่านมา

    I CAN'T FKING HEAR YOU, TURN UP YOUR VOICE PLS :(((((

  • @GostGostcic
    @GostGostcic หลายเดือนก่อน +1

    this video is so bad, he could make this code 10x faster with jobs but he made so many mistakes in the video lol

    • @OIndieGabo
      @OIndieGabo หลายเดือนก่อน +5

      This comment means nothing if you are not pointing out how the solution would actually be improved. There is no harm on pointing mistakes out and explaining them so everybody can grow on it.
      What you did here is just offensive. And if this is was your intention it becomes clear why we should not listen to what you are saying and just ignore you in the future.

    • @GostGostcic
      @GostGostcic หลายเดือนก่อน

      @@OIndieGabo [ReadOnly] works only on native containers not the normal variables, boid Transforms should have null parent (this is extremely important) and updated only with TransformAccess.SetLocalPositionAndRotation(...), then he should show profiler because this is not the bottleneck (because can handle 100k+ updates per frame easily), he is doing something else wrong. i could go on... but the point is, dont watch this, he is missing the point of the JOBS and what they do.

    • @ehabelbwab1783
      @ehabelbwab1783 หลายเดือนก่อน

      @@OIndieGabo Agree