❗❗ *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
You can always "hack" that limitation of having only one value by using custom struct. For example: using System; using Unity.Entities; [GenerateAuthoringComponent] public struct DynBufferComponent : IbufferElementData { public Workaround valuesSet; } [Serializable] public struct Workaround { public int valueInt; public char valueChar; } I very appreciate your content - in addition to next DOTS feature I was able to learn about custom operators for implicit and explicit conversions. Without it, I didn't even know that something like that exists! :D
That's a cool workaround, just tried it out, works as intended. Thanks for sharing! 👍 Also yeah making custom operators is a cool C# language feature you can use to clean up your code a bit 😊
REALLY COOL HACK! I was using a float3x3 data type for my buffer element and it was getting very annoying. I'm still wrapping my head around the theory of chunk utilization and structural changes. Is valueint and valuechar stored in the same chunk as valueSet?
@@wasteurtime5677 In the way I suppose you understand - the answer is "yes". Both values inside struct are together in memory, one near one. Or at least I understand this that way. Chunk in ecs is like a box made from colorized paper. Box is the chunk, color is archetype, stuff inside box (steel balls, made from elements, which are components) are entities, capacity of the box is size of chunk - if you have too much entities, you need another box/chunk to store more. Something like that, hope that's helpful and is NOT DOTS-heresy ;D
I would be interested if using the DynamicBuffer in a "IJobEntityBatchWithIndex" would be usable and how it's done :D Maybe you can make a tutorial about that @Turbo
Good to know you'd be interested in something like that! Is this something you've been having issues with? If so what? Also, what's your use case for using them in and IJobEntityBatchWithIndex specifically? Thanks!
Great question! They have many similarities, however there are situations where it makes sense to use DynamicBuffers over Native collections. DynamicBuffers are best used for "per-entity" storage as the data can live in the chunk for fast memory access inside jobs. They also have helper functions to convert them to NativeArrays if you ever need to store/access the data in a native collection anyways