How to Use the Entity Manager in Unity ECS - DOTS 2022 Tutorial [ECS Ver. 0.17]

  Рет қаралды 7,643

Turbo Makes Games

Turbo Makes Games

Күн бұрын

❗❗ Caution: This video was made with an older version of ECS. See pinned comment for further Details ❗❗
📌 Download the project files from this video: tmg.dev/ECS_EntityManager 📌
Code Featured in This Video: tmg.dev/EntityManager_Code
Unity DOTS Best practice Guide:
💻 My Game Development Setup: tmg.dev/GameDevPC 💻
👇 See below for time stamps 👇
- 0:00 - Unity ECS Entity Manager
- 1:03 - What is the Entity Manager
- 2:55 - What happens when you add a component to an entity
- 5:03 - Hierarchy of Making Changes to Entities
- 6:20 - [Tutorial] Unity Project Setup
- 7:15 - [Tutorial] Referencing the Entity Manager
- 8:13 - [Tutorial] Create Entities
- 9:33 - [Tutorial] Create Entities from Prefab
- 10:27 - [Tutorial] Setting Component Data
- 11:23 - [Tutorial] Adding Components to Entities
- 12:13 - [Tutorial] Destroying Entities
- 13:23 - Fed up with ECS???
- 13:47 - Wrap up and Final Thoughts
Links:
Blog: tmg.dev
Twitch: / turbomakesgames
Twitter: / turbomakesgames
Game Studio: homecookedgames.com
GitHub: github.com/JohnnyTurbo
Music by: Joakim Karud / joakimkarud
📸 My Camera Gear: tmg.dev/CameraGear 📸
🎮 Let me know what other topics you want to learn about 🎮
#UnityDOTS #UnityECS #MadeWithUnity
Please 'Like' this video and share it with anyone who is interested in video game development.
Subscribe to the channel for much more independent video game developer related content including tutorials, design breakdowns, industry events, VLOGs, and much more fun stuff!

Пікірлер: 41
@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: kzfaq.info/get/bejne/f7VmkpmKxL-5lHk.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
@xanderlinhares
@xanderlinhares 3 жыл бұрын
Almost no one is really covering ECS, it's great to see you give it some love!
@TurboMakesGames
@TurboMakesGames 3 жыл бұрын
Been having fun with it, glad you've been enjoying!
@jtprukop
@jtprukop 5 ай бұрын
Can't tell you how helpful your videos have been in my exploration of ECS. Thank you for putting your knowledge out into the world!
@TurboMakesGames
@TurboMakesGames 5 ай бұрын
Thank you so much for the support! So glad to hear these videos have been so helpful to you 😊
@FlipYourLearning
@FlipYourLearning 2 жыл бұрын
Thanks for including the explanation of different ways of creating and changing entities. Something that makes ECS hard to learn is the bunch of different ways there are of doing what seems like the same thing.
@TurboMakesGames
@TurboMakesGames 2 жыл бұрын
Definitely understand how that can be tricky to navigate - it's also tough because sometimes one way of doing things is better than another depending on the circumstances
@user-ng6xz3uo9c
@user-ng6xz3uo9c 3 жыл бұрын
I always appreciate your videos about ECS
@TurboMakesGames
@TurboMakesGames 3 жыл бұрын
Thanks for the support 😀
@LukeClemens
@LukeClemens 3 жыл бұрын
Wow, I never saw that section in the docs about how much needs to get done when adding a component before.... that's a lot! Reading that underscores that we need to be careful when deciding when to use tagging vs booleans.
@TurboMakesGames
@TurboMakesGames 3 жыл бұрын
Yeah it was definitely eye opening for me, but it kinda makes sense why it has to do all that. Think this brings up some good conversations on how to generally make decisions for designing your games with data oriented programming in mind - when it makes sense to choose one method over another. Would like to do more videos discussing these things soon 😊
@joshxwho
@joshxwho 2 жыл бұрын
Great video!
@TurboMakesGames
@TurboMakesGames 2 жыл бұрын
Thanks, glad you enjoyed!
@NewbNinjas
@NewbNinjas Ай бұрын
Legend.
@a.technology1446
@a.technology1446 3 жыл бұрын
Thanks Johnny
@TurboMakesGames
@TurboMakesGames 3 жыл бұрын
You got it!
@LukeAps
@LukeAps 2 жыл бұрын
I had no idea there was a float4x4.Translate function. Thanks man, can finally fix some of my janky unit spawning behaviour. I'm not so sure about the example of the oscillating system working on LocalToWorld rather than Translate, but I'll assume it's just faster than waiting for the system to operate on Translate or something in this situation.
@TurboMakesGames
@TurboMakesGames 2 жыл бұрын
Nice, glad to hear this will help you clean up that system! If you haven't already, check out the video I did on translations in ECS, it'll explain that a bit better. Basically, the LocalToWorld component is the end all, be all of where an entity exists in the world. Modifying the Translation component doesn't move the entity right away, rather there is a system that runs later in the frame that takes in the translation, rotation, and scale components to calculate the LocalToWorld.
@LukeClemens
@LukeClemens 3 жыл бұрын
Great vid! This is way off topic, but I've never really understood the philosophy behind using different worlds in a game. As you said, each world uses a different manager. So far I've never used anything other than the default world and nearly all other code I've looked at it is the same. Scenes, and subscenes make sense... scenes are usually used for different levels or screens and subscenes are used for things like grouping similar entities so they can serialize really fast, avoiding ConvertToEntities scripts on everything, or loading/unloading sections of a map during gameplay. But why would we want two or more worlds? Is it mainly a multiplayer thing?
@TurboMakesGames
@TurboMakesGames 3 жыл бұрын
Funny you mention that, I was recently doing some research into this to possibly make a video on Worlds, but I started to come to the same conclusion that you did. Does seem like there are some use cases for it - mainly for networking like you mentioned. Also it seems like implementing it, in most cases seems to be more trouble than it is worth having it. Curious to see if this is an area that evolves more as ECS continues development.
@myelinsheathxd
@myelinsheathxd 3 жыл бұрын
Nice! Can you make a video about ML agent package + DOTS.? Since ML agent's brain runs parallel using job system, however its any other world interactions code runs in single thread. And this has been typical issue in the community. Since all the time I did write reward +mechanics functions in just usual mono update method. As a result when the agents duplicated in the scene during training mode, CPU thread usage was just only 2 out of 16 threads.
@TurboMakesGames
@TurboMakesGames 3 жыл бұрын
Sounds like that could be interesting. I'll look into it!
@thegnosticatheist
@thegnosticatheist 3 жыл бұрын
@TMG, Philippe released his Rival - DOTS Character Controller package recently. Maybe it's good idea to check it and create a small walkthrough series?
@TurboMakesGames
@TurboMakesGames 3 жыл бұрын
Oh nice! I heard he was close to finishing it but didn't know it got released yet. Will definitely check it out!
@thegnosticatheist
@thegnosticatheist 3 жыл бұрын
@@TurboMakesGames yeah, it's very recent. I suggest grabbing it while it's discounted: assetstore.unity.com/packages/tools/physics/rival-dots-character-controller-195567 Haven't had time to dig into myself yet but based on his previous work I have high expectations!
@dvgen
@dvgen 3 жыл бұрын
I'll second the general comment of check it out. May or may not be useful content, but I've been following the project for a long time and bought it as soon as it was released. Haven't had a whole ton of time to play with it though.
@Freakhealer
@Freakhealer 3 жыл бұрын
Unity DOTS Best practice Guide: :)
@TurboMakesGames
@TurboMakesGames 3 жыл бұрын
It's super helpful!!
@MrMorvar
@MrMorvar 2 жыл бұрын
Slightly late but just wrote this myself and all capsules are created over each other. That CalculateTransform method doesn't seem to work for some reason. As a workaround, one can set the positions with spacings like this: Vector3 position = new Vector3 (x * _entitySpacing.x, 1f, y * _entitySpacing.y); EntityManager.SetComponentData (newEntity, new Translation { Value = position });
@TurboMakesGames
@TurboMakesGames 2 жыл бұрын
Thanks for sharing what worked for you!
@lnPower
@lnPower Жыл бұрын
Сould you share a link to the material where you solve the many-to-many problem (for example, each object in the array needs to move to its point) in the most productive way. Thank you.
@TurboMakesGames
@TurboMakesGames Жыл бұрын
Using the ECS design pattern, you can operate on things parallelly and in batches - thus highly optimizing many to many operations. I do have some plans to do some more in-depth performance testing with different things along these lines...
@user-fy6wd4yl3y
@user-fy6wd4yl3y 3 жыл бұрын
I wrote the code according to your video and found that only 64 entities were generated in the same place, and unity reported an error: assertion failure. Value was null. The same error will be reported in your project
@TurboMakesGames
@TurboMakesGames 3 жыл бұрын
That's strange, I'm not seeing that same error. Is there something going on with the "CalculateTransform" function? Or is it another line that is reporting the error?
@Aedeus
@Aedeus 3 жыл бұрын
Ok, I have one for you: Lighting! I got shadows and directional lights working just fine in pure ECS, but spot light and point lights which support realtime have me pulling my hair out. If you find a solution, it would be quite amazing as documentation is sparse.
@TurboMakesGames
@TurboMakesGames 3 жыл бұрын
Sounds good! I'll add it to the list 😊
@Aedeus
@Aedeus 3 жыл бұрын
@@TurboMakesGames Also a quick fact finding tip there, word on the street is that Hybrid Renderer V2 doesn't yet support spot and point in URP, but somehow does in HDRP? So probably will need a HDRP scene to show off those lights.
@LukeClemens
@LukeClemens 3 жыл бұрын
I agree - I finally gave up on point lights (via HRV2).
@mrbinggrae5954
@mrbinggrae5954 3 жыл бұрын
Do you know the release date of Unity ECS?
@joepeters8746
@joepeters8746 3 жыл бұрын
there is no release date, they will need years of developmentto get ECS in an usable state
@TurboMakesGames
@TurboMakesGames 3 жыл бұрын
Unfortunately, like Joe said, there is no release date or even official timeline from Unity. They are taking their time to make sure everything is working right before committing to a release schedule.
How to Use Dynamic Buffers in Unity ECS - DOTS Tutorial [ECS Ver. 0.17]
16:28
Женская драка в Кызылорде
00:53
AIRAN
Рет қаралды 434 М.
Beautiful gymnastics 😍☺️
00:15
Lexa_Merin
Рет қаралды 15 МЛН
Generate RANDOM VALUES in ECS - Unity DOTS Tutorial [ECS Ver. 0.17]
14:52
Java Is Better Than Rust
42:14
ThePrimeTime
Рет қаралды 71 М.
Unity Job System - A Practical Code Example
13:50
Infallible Code
Рет қаралды 81 М.
Easy Pathfinding for ECS and MONO [Agents Navigation Asset Review]
16:19
Turbo Makes Games
Рет қаралды 14 М.
Unity - How to create a Pixelation Transition in Unity!
18:16
Stick Wizard
Рет қаралды 179