Тёмный

Using Blob Assets for Central Data Storage in Unity ECS - DOTS Tutorial [ECS Ver. 0.17] 

Turbo Makes Games
Подписаться 26 тыс.
Просмотров 8 тыс.
50% 1

❗❗ Caution: This video was made with an older version of ECS. See pinned comment for further Details ❗❗
📌 Download the full project files: tmg.dev/BlobAssets 📌
👨‍💻 Code/Scripts from this video: tmg.dev/BlobAssets-Code 👨‍💻
💬 Come chat with other DOTS/ECS devs: tmg.dev/Discord 💬
🚧 Resources Mentioned 🚧
- Code Monkey video on Blob Assets: • What are Blob Assets?
- My Singletons in ECS video: • How to Use SINGLETONS ...
- My Change Filters in ECS video: • How to Use Change Filt...
💻 My Game Development Setup: tmg.dev/GameDevPC 💻
📸 My Camera Gear: tmg.dev/CameraGear 📸
🎮 Let me know what other topics you want to learn about 🎮
⌚ Time stamps for key topics ⌚
- 0:00 - Blob Assets in Unity ECS
- 1:24 - What are Blob Assets
- 3:15 - When to use Blob Assets
- 4:45 - Overview of Blob Asset Creation
- 6:14 - [Tutorial] Unity Project Overview
- 6:53 - [Tutorial] Create the Structure of the Blob Asset
- 8:29 - [Tutorial] Creating a Blob Asset Array
- 9:53 - [Tutorial] Creating a Blob Builder
- 10:53 - [Tutorial] Calling the ConstructRoot Method
- 11:39 - [Tutorial] Allocating Memory for the Blob Asset Array
- 12:06 - [Tutorial] Populating the Blob Asset Array
- 13:17 - [Tutorial] Creating a Blob Asset Reference
- 15:07 - [Tutorial] Accessing Blob Asset Data
- 16:36 - Final Demonstration
- 17:47 - Summary and Wrap up
🌐 Find Me Online! 🌐
📄 Blog: tmg.dev
👨‍💻 GitHub: github.com/JohnnyTurbo
🎮 Games: johnnyturbo.itch.io/
🦅 Twitter: / turbomakesgames
📺 Twitch: / turbomakesgames
🎵 Music by: Joakim Karud / joakimkarud
#️⃣ #UnityDOTS #UnityECS #MadeWithUnity

Опубликовано:

 

28 июн 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 36   
@TurboMakesGames
@TurboMakesGames Год назад
❗❗ *Caution:* This video was made using an older version of Unity ECS. While the core concepts remain the same, some of the API and workflows have changed as of ECS version 1.0. I would recommend checking out my ECS 1.0 tutorial video for a good overview of the latest standards for Unity’s DOTS: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-IO6_6Y_YUdE.html Once again, the theory behind the concepts of this video are still relevant, however the API has changed. Stay tuned for further updated videos on this subject. Please let me know if you have any questions either here or in our Discord community: tmg.dev/Discord
@LukeClemens
@LukeClemens 2 года назад
Sweet!! I always wondered what those blob assets were all about but never got around to figuring them out. Also I learned something new about C#'s "using" keyword.
@TurboMakesGames
@TurboMakesGames 2 года назад
Yeah definitely! I feel like blob assets are one of those topics that sound a lot scarier than they actually are - especially once you start to use them, they make a whole lot more sense.
@Songfugel
@Songfugel 2 года назад
Thanks for this video, I had to return to this topic after a years pause, and couldn't for the life of me remember how I had done it in my previous projects. Such a huge struggle to get the most simplest of tasks a programmer does in a matter of seconds, oh the things we do for that little bit of extra speed and efficiency
@TurboMakesGames
@TurboMakesGames 2 года назад
Hehe, glad you liked the video. Stay tuned for some time saving ways to reduce the amount of boilerplate code I write in ECS... 😉
@FlipYourLearning
@FlipYourLearning 2 года назад
This was definitely harder than other concepts and I will need to practice with them to completely wrap my head around the concept and all the steps needed to use them, but they do seem useful. Thanks for the tutorial.
@TurboMakesGames
@TurboMakesGames 2 года назад
Yeah this is definitely a tough one to wrap your head around at first, I think a lot of the boilerplate code makes it seem more confusing than it actually is. Once you use them to solve a practical problem, they make much more sense.
@Forjugadname
@Forjugadname 2 года назад
I am glad I watched this vid even though I thought I new how to use blob assets as they seem way easier to create and assign to now.
@TurboMakesGames
@TurboMakesGames 2 года назад
So glad to hear this! I always find it so valuable to watch tutorials on things I think I already know pretty well - a lot of times I find I end up filling in gaps in my knowledge I didn't even know I had
@garryguan7115
@garryguan7115 2 года назад
Keep it up. Love your videos :). I feel like this talk could have paraphrased the documentation rather than explaining each concept one after another, verbally. Overall, great video my guy.
@TurboMakesGames
@TurboMakesGames 2 года назад
Appreciate the feedback, always looking for ways to improve these videos. Glad you enjoyed 😀
@NomortaL
@NomortaL 2 года назад
I know the lines get long, but don't be afraid to declare the type of variable. It makes it easier to understand instead of using 'var' everywhere
@TurboMakesGames
@TurboMakesGames 2 года назад
Appreciate the feedback, will take this into consideration, cheers!
@wlsmdltn
@wlsmdltn Год назад
Thank you sooooooooooo much. May someone think it isn't nessasery. But if you wanna change SphereCollider or else basic collider, you should use this.
@TurboMakesGames
@TurboMakesGames Год назад
Yes, DOTS colliders use blob asset references!
@TurboMakesGames
@TurboMakesGames 2 года назад
Hey all! I know this video is a bit more code-heavy than normal and you don't see a whole lot going on in the Unity editor, so I hope it is easy enough to follow along with. As always, please let me know if you have any questions on this! Happy Blobbing 👽
2 года назад
I wonder why they didn't make an editor version where you create blob assets just like scriptable objects. It's as a replacement of SO I would like to use this anyway but it becomes very tedious when you need to convert SO with a million steps.
@LukeClemens
@LukeClemens 2 года назад
@ Hmmm... that's a pretty cool idea. I wonder if anyone has tried to make a plugin/package for unity editor to do that.
@TurboMakesGames
@TurboMakesGames 2 года назад
@ Exactly what Luke said, seems like a great idea for a custom editor tool 😊
2 года назад
@@TurboMakesGames I think it should be doable with the same codegen method they used for authoring components, right? Or am I missing something? Seems strange they didn't just do it if it was that simple..?
@calccalccalc
@calccalccalc 2 года назад
Hey Turbo! I suggest doing some ECS/DOTS for UGUI. Would be super useful.
@LukeClemens
@LukeClemens 2 года назад
What are the advantages of using a blob asset vs an ordinary singleton entity that you only ever read from? If you only ever read data from the singleton entity's components wouldn't it be equally as fast? I suppose a blob asset would guarantee that you don't accidentally write to it, but it seems like that's a pretty minor issue compared to all the extra code required for setting up blob assets. I think the would both use the same amount of memory. Thoughts?
@TurboMakesGames
@TurboMakesGames 2 года назад
Good question, performance-wise yeah, they're probably about the same. The thing you get with blob assets is "guaranteed" immutability, meaning the data is guaranteed to be able to be read from multiple systems/jobs/threads at once. I say guaranteed in quotes as you can do things like I did in my game of life where the blob asset pointed to entities, and while the entities stayed the same, the components on the entities didn't have the same guaranteed immutability. With a singleton you're only reading from, it's like a pseudo-guarantee, where you know that as the developer know that it will never change, but there are no built-in safety systems to prevent you from doing this. Only other thing I can think of right now would be blob arrays, but you could use something like dynamic buffers on your singleton
@starburstdragon
@starburstdragon 2 года назад
So this kind of data - immutable(like say spaceship max speeds, max turn speeds, max HPS etc) - can be stored 1. blob assets 2. components(singletons) - and i believe i read on forum but that was an old thread - in 3. static classes like readonly fields(i think it's possible to use static readonly data from jobs too) - it would be nice to see which method is the most performant especially if this kind of structs that hold the data contains a lot of fields(i bet on 2. but not sure 100%)...
@TurboMakesGames
@TurboMakesGames 2 года назад
Don't know for sure, but I'd say blob assets would be more performant over singleton components because of guaranteed immutability, meaning no safety checks need to happen. Static readonly fields could work but it seems like a bit of a code smell to me as it kinda breaks the ECS model. But great thoughtful comment though!
@ciberdead9301
@ciberdead9301 2 месяца назад
Hi, i've got a question, how would you do the construction of the blob asset in a baker, because whenever i'm trying to do this, when i'm allocating the reference to an entity in a baker i have a leak warning from unity
@mana20
@mana20 2 года назад
Would you use this for an item system where nothing changes? Or is there a better ECS system for this use case ?
@TurboMakesGames
@TurboMakesGames 2 года назад
Depends on what exactly you are trying to do. So long as the data is unchanging, then yes, a blob asset could be used for something like that. Though often times in games items do have the ability to change over time, maybe they get weaker with use or you can add behavior to them by combining other items. So I could see blob assets being used as a way to store the "base" stats of all the items in your game, then when a player gets an item, those values are copied into something that is mutable like a dynamic buffer. Also I should point out that most people still use OOP for the front-end UI logic of inventory selection/crafting screens as it is easier to do and doesn't really benefit from the performance gains of ECS anyhow. Hope that helps!
@swapnilrane24
@swapnilrane24 2 года назад
How to build apk file of Dots Project?
@TurboMakesGames
@TurboMakesGames 2 года назад
I'm planning on making some videos soon discussing making builds for DOTS games on different platforms.
@blitzkreig4887
@blitzkreig4887 11 месяцев назад
Is Blob Asset a Scriptable Object for DOTS ? Seems very similar.
@TurboMakesGames
@TurboMakesGames 11 месяцев назад
Kindof! There are a lot of similarities between the two. However just keep in mind that Blob Assets are for static data only
@Tetro48
@Tetro48 2 года назад
blob assets mentally hurt my brain a bit.
@TurboMakesGames
@TurboMakesGames 2 года назад
They do at first, but once you use them and figure out how best to use them, they begin to make much more sense. It's really just a way to store and reference data that does not change.
Далее
Занимайся йогой со мной 🫶🏻
00:13
What are BlobAssets ? How to use them ?
8:02
Просмотров 2,6 тыс.
Options for Entity interaction - Unite Copenhagen
43:12
Unity Code Optimization - Do you know them all?
15:49
Просмотров 183 тыс.
How I Created 2D Pixel Art Water - Unity Shader Graph
14:11