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

Поделиться
HTML-код
  • Опубликовано: 31 май 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
  • ИгрыИгры

Комментарии • 20

  • @majin2909
    @majin2909 14 дней назад +3

    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

  • @naolshow
    @naolshow 15 дней назад +4

    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.

  • @RobLang
    @RobLang 15 дней назад +2

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

  • @b5fan504
    @b5fan504 3 дня назад

    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.

  • @OIndieGabo
    @OIndieGabo 14 дней назад

    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).

  • @janseenvideogaming
    @janseenvideogaming 13 дней назад

    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

  • @TheArghnono
    @TheArghnono 15 дней назад +1

    Excellent tutorial!

  • @AlexHosseini
    @AlexHosseini 15 дней назад

    Oh boi that was a nice explanation.

  • @Dragoncro0wn
    @Dragoncro0wn 15 дней назад +1

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

  • @danielwertz8724
    @danielwertz8724 15 дней назад

    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!

  • @PhiLudo
    @PhiLudo 15 дней назад

    cool stuff

  • @user-rm2pj9jf8s
    @user-rm2pj9jf8s 15 дней назад

    I love it

  • @privatdetektivenkant5975
    @privatdetektivenkant5975 15 дней назад +1

    Give me more!!!!!

  • @redragon1229
    @redragon1229 15 дней назад

    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.

  • @Coco-gg5vp
    @Coco-gg5vp 15 дней назад

    First

  • @GostGostcic
    @GostGostcic 14 дней назад +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 14 дней назад +4

      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 13 дней назад

      @@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.