Optimizing Code using Unity's C# Job System (Tech Demo)

preview_player
Показать описание

In this video I show off an ocean simulation that I created using mesh deformation. We'll put Unity's new C# Job System to the test by optimizing the code used for the demo.

My Favorite Unity Assets 💯⤵️

* Disclosure: These are affiliate links, which means I'll receive a commission if you use them to make a purchase.
Рекомендации по теме
Комментарии
Автор

This is incredibly helpful. I was literally looking into the job system to speed up a mesh deformation, so I can pretty much copy exactly what you've done here. Thanks muchly.

garywood
Автор

9:42 & 10:47
I don't normally gasp when watching code reviews, but that performance gain. With 2018.1 officially launching today, I'm finally taking time to look a features my studio can use. Large area mesh deformations and changes is one of the areas where we need this kind of boost. Now we may actually be able to make mountains melt (erode) without having to take either the sim or the player's computer to a crawl. Your video here is perfect demonstration of how the Job System can help processes spread out of geographic areas, which really do benefit from running in parallel.

brasten
Автор

I'm quite late to the party, but this is new to me! I didn't know we had such a simplified system for "jobs" already handled by Unity. Thanks for the video demonstration.

honeybadger
Автор

A neat look at the job system!

I was just wondering that did you try omitting the per-frame allocation and copy? I haven't tried the beta, but I imagine you could allocate the NativeArray on initialization and then reuse it in subsequent updates. Additionally, you could just store floats in the array to cut down on memory usage, since you're only updating the Z position, although the performance benefits of that need to be measured.

Thanks.

Zorkkaelain
Автор

This is great. I've not been following U2018, as I'm still completeting a project on 5.6!

About time this system for taking advantage of CPU threads is here!

doghous
Автор

Love this video! I hope youtube promotes more technical content with a human touch. May the force be with you!

rationalistfaith
Автор

Awesome video as always.
Having someone take a better look into an undocumented feature, and putting all the findings in a demo, is the kind of stuff we need more of :)

lupidan
Автор

Great explanation! Strange example though... Don't you think letting the GPU and a shader handle this rendering fits a bit more naturally for the application?

Either way, I'm excited to check out more of your videos :)

brandonrivera-melo
Автор

Wow, finally, an understandable video about the upcoming C# Job System. Kudos!

akhcade
Автор

Best intro! Now I start jobifying! So great!

kianchristoffern
Автор

You are wrong in saying that classes take longer to access in memory. It is ALL in RAM using a register pointer. The only thing that is better is 1. it is faster to ALLOCATE memory on a stack, and 2. the GC does not get involved for structs, so no GC lag. In fact, the GC is completely out of the picture in the job system.

"Even worse though is the frequently-seen characterization that value types are 'small and fast' and reference types are 'big and slow'. "

PlanetOutpost
Автор

I can imagine this already being a default thing to make for any game with multiplayer.
Having over 30 players or lots of enemies it seems like a no brainer to use an IJobParalellFor interface to handle the network and basic character functions everyone uses such as movement or other features.

magnusm
Автор

I'm subbing in hopes that someday I'll watch this video and know what the heck you're talking about

dadsanddragons
Автор

When I did terrain deformation for my Hover Warz multiplayer game, I had to split up the terrain into chunks. I tried using unity jobs on some of the calls but it wasn't supported. In the end I did achieve a much better affect splitting up the terrain. One particular function would target the entire terrain when I didn't need that! Jobs can be used for calculations sure, but not for all things sadly, some calls just aren't supported. Who knows if and when some of the long expensive calls will be supported.

ZaCkOX
Автор

Very nice video! More job system please. This need to be second nature. Very useful! Consider chipping in on Patreon now!

happyfarang
Автор

Hey dude, this is awsome stuff... FINALLY someone explaining this in a comprehensible way :-D
I would love you to add an explanation of the Allocator thing in your code... and other than that... loved it..
Will definitely go on patreon...
Many thx for saving loads of headaches

olieolieolieolie
Автор

That was incredible. You deserve a subscribe.

karandhir
Автор

wow. I don't know if you just added it for the video, but I've been listening to Arctic Empire's videos while working in Unity for 3 years lol.

Moby
Автор

I could be wrong, but I believe you only need to call .Complete() on the final job in the list of dependencies.

JunkerJames
Автор

Really good video! Beside I watched it on 2x speed

SinanAkkoyun