Тёмный

Unity DOTS: Creating an Entity 

Wilmer Lin GA School
Подписаться 12 тыс.
Просмотров 50 тыс.
50% 1

In this episode, we create an Entity using "pure ECS" and use an EntityManager and EntityArchetype to create a simple cube from scratch. We also explore the EntityDebugger interface, which is essential to working in DOTS.
Want to learn more about DOTS and ECS? Sign up for our mailing list to get notified when the premium course releases:
gameacademy.school/1109-2/
Final project on GitHub:
github.com/UnityGameAcademy/D...
Software: Unity 2019.3.2f with HybridRender Version 0.3.4 and Entities Version 0.6.0 from PackageManager.
UPDATE: this video was updated to use the HybridRender Version 0.3.4 released on 02/17/2020 (which now requires adding the RenderBounds to the EntityArchetype).

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

 

16 июл 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 97   
@robertkasper9890
@robertkasper9890 2 года назад
I love this tutorial! Great work. PSA for anyone using URP or HDRP, you'll need to use the RenderMeshUtility instead of AddSharedComponentData to add your rendering data: RenderMeshUtility.AddComponents(myEntity, entityManager, new RenderMeshDescription(unitMesh, unitMaterial));
@emilpolak1170
@emilpolak1170 Год назад
I was looking for this very answer on every possible forum about ECS in Unity, but unsuccessfully. You saved me stranger, thank you!
@hellsbuster
@hellsbuster Год назад
This comment needs to be GOATed.
@MikeCroswell
@MikeCroswell Год назад
@@hellsbuster RIght. One of the greatest videos and useful follow-up post!
@ferdowsurasif
@ferdowsurasif 4 года назад
Straight forward and informative. Awesome tutorial!
@HadiLePanda
@HadiLePanda 4 года назад
I like the way you explain things, it's informative and easy to understand :)
@aldigangster123
@aldigangster123 4 года назад
Great introduction to ECS!
@VMartinez144
@VMartinez144 4 года назад
Very instructive. Thank you so much for taking the time to do this class.
@uni-mal4433
@uni-mal4433 4 года назад
Thank you for immediate updating contents!
@softwaregeezers2905
@softwaregeezers2905 4 года назад
Superb tutorials. Clear, focussed, and professionally executed.
@FREDO-py4ti
@FREDO-py4ti 3 года назад
Entity = things, Component = data, System = logic !!! Now i'm starting to understand DOTS !!! Thank you !!!😍😍😍
@FeedMyKids1
@FeedMyKids1 3 года назад
Great tutorial. I was trying to figure it out via Unity Documentation but I couldn't find an example as easy to understand as this. Thanks.
@ash12181987
@ash12181987 3 года назад
Thank you so much, I'd been looking for a clear explanation of this for days now.
@randomeda
@randomeda 3 года назад
Finally, a great tutorial for ECS!
@carl-johanhorberg1399
@carl-johanhorberg1399 3 года назад
Thank you so much for the very comprehensive and efficient guide, you deserve a big chocolate cake
@PSNsomeonealive
@PSNsomeonealive 4 года назад
Great tutorials mate keep it up!
@Army21
@Army21 4 года назад
Excellent clear explanation - many thanks
@vladhorodnii6497
@vladhorodnii6497 2 года назад
The best tutorial even in 2022. Thank you for your videos!
@peterparker31
@peterparker31 Год назад
I'm not getting entity and hybrid renderer packages, I'm using 2021.3.5f1
@autorotate1803
@autorotate1803 4 года назад
Best tutorial on the internet, thank you!
@gndevelopment6798
@gndevelopment6798 4 года назад
Many thanks for keeping this current.
@gndevelopment6798
@gndevelopment6798 4 года назад
unitylist.com/p/zro/Unity-DOTS-Following-Along
@qin6409
@qin6409 2 года назад
believe me, I searced the whole youtube and including bilibili, this is easiest and clearest video. If there has tip functions, I absolutely will tip this professor
@lkhprime
@lkhprime 4 года назад
awesome, keep going, ur videos are really good and helpful !!
@Peak_Stone
@Peak_Stone 4 года назад
Best teacher in the world right here.
@supercc66
@supercc66 4 года назад
i like you clearly share. very good !!
@neonterran
@neonterran 3 года назад
you are sooooooooooooooo underrated
@OwlTeaGames
@OwlTeaGames 4 года назад
It looks like the newest version has renamed Entity 0 to "World Time.' It's still Index 0, it just has a proper name. Cool.
@GameAcademySchool
@GameAcademySchool 4 года назад
Yeah I think that came with Entities 0.6
@workflowinmind
@workflowinmind 3 года назад
Lol, doing better lessons than Unity itself, thanks a lot
@bayernmaik8583
@bayernmaik8583 2 года назад
Good stuff! Can someone help me out with documentation on what Component Types there are and which Properties they have? Docs seems to be vague about this
@strueaudio3691
@strueaudio3691 4 года назад
Thanks! One question though: We specify in our archetype that we want a translation component on the entities we create from that archetype. If we then say entityManager.AddComponentData(...), don't we add a component that's already there? Shouldn't it be entityManager.SetComponentData(...)? That's at least how the documentation describes it.
@GameAcademySchool
@GameAcademySchool 4 года назад
Yes, you are correct, it should be SetComponentData if the Entity already has the Component.
@toddwasson3355
@toddwasson3355 4 года назад
Those packages (Entity and Hybrid Renderer) don't show up in my package manager. I'm using Unity 2019.3.6f1. Any ideas? Could they have changed the names in the last month since this video was made?
@toddwasson3355
@toddwasson3355 4 года назад
Found it. In Package Manager click "advanced," then "show preview packages." Then both packages will show up.
@TylerButh
@TylerButh 2 года назад
When my rendermesh is a quad with RenderBounds the renderer doesn't render the mesh until the center point is in camera view.
@marcinziajkowski3870
@marcinziajkowski3870 2 года назад
If I want animation for 3d model then I just add archetype Animation and field Animation animation to Component struct ?
@emptybruh
@emptybruh Год назад
Could you make a prefab and spawn that instead of putting material and mesh in a spawner?
@tomoyaae667
@tomoyaae667 4 года назад
I wrote the code in 3:45,but in Entity Debugger "No World selected" is displayed. Color of World in "World.DefaultGameObjectInjectionWorld.EntityManager" doesn't change in VSCODE.
@King-mj2bn
@King-mj2bn 2 года назад
You're not using AddComponentData properly. Those components have already been defined by the archetype. In previous versions, this would've caused an exception to be thrown, though that function has since been changed into a sort of "safe set" where it performs a check to see if the component exists before setting the value and creates it if it doesn't. But this also means it's naturally a bit slower than SetComponentData which skips that check entirely. And lets face it, the entire point of ECS is squeezing every last drop of performance out of the engine.
@mnnm1989
@mnnm1989 4 года назад
I cant use a default created 3d object or a 3dModel I created with ProBuilder as mesh, what does the mesh need that I can drag it into the spawner scripts? thx Edit: ok i found a way, i need to export the model i made with Probuilder to .obj first, then a mesh appears that i can use.
@whiitehead
@whiitehead 4 года назад
Just get the Hybrid Renderer package, it will install the others as deps
@GameAcademySchool
@GameAcademySchool 4 года назад
Caleb Whitehead Yes that is a good way to make sure the versions are compatible.
@DeathxStrike18
@DeathxStrike18 3 года назад
current version of Unity 2019 does not include hybrid renderer
@BanditBloodwyn
@BanditBloodwyn 2 года назад
I have a problem with all this. The entities I create have the right mesh, but they appear completely black, as if they don't receive any light. Does someone have an idea?
@willabyuberton818
@willabyuberton818 4 года назад
I have preview packages enabled, but Entity and Hybrid Renderer aren't available. Did the names change in the past few months?
@nicklaslof
@nicklaslof 4 года назад
Unity have hidden these packages. I just found out myself. You have to go to the Package manager click the + button at the top and select "Add package from git URL" and paste in "com.unity.entities" and after 5-10 seconds of nothing happening the package will install. Repeat again for "com.unity.rendering.hybrid". forum.unity.com/threads/visibility-changes-for-preview-packages-in-2020-1.910880/ for more info
@MrKraignos
@MrKraignos 3 года назад
From the Package Manager window: Advanced > Show Preview Packages
@unrealdevop
@unrealdevop 3 года назад
@@MrKraignos I did that and it didn't work....Tried it under the 2020 and 2019 versions and couldn't find it
@samsil187
@samsil187 3 года назад
How come my script isn't recognizing "Translations"? I am using unity.Transforms, but I dont know.
@diocre7446
@diocre7446 3 года назад
This thing is already in Cryengine since 2016
@borzonstudios8638
@borzonstudios8638 4 года назад
Before diving too deep in this topic, I am wondering if all this could hypothetically be used for mass destruction physics. So hundreds or thousands of kinematic rigidbodies in the scene under the influence of forces. Would ECS suit something like this?
@GameAcademySchool
@GameAcademySchool 4 года назад
Andorf The White Yes, if you wanted robust physics, DOTS and the new Unity Physics framework (or Havok framework) is what you want to use.
@borzonstudios8638
@borzonstudios8638 4 года назад
@@GameAcademySchool Thanks for the quick reply!
@xzijoqqojizx8184
@xzijoqqojizx8184 4 года назад
help anyone ,how does one know what are the things required to render entity, like RenderBounds. Where are these things documented, i didn't find that in ecs manual
@GameAcademySchool
@GameAcademySchool 4 года назад
A lot of things have pretty sparse documentation at the moment. You can find the latest documentation about the HybridRenderer here: docs.unity3d.com/Packages/com.unity.rendering.hybrid@0.4/manual/index.html If you go to the Scripting API pages, you can find specific descriptions: docs.unity3d.com/Packages/com.unity.rendering.hybrid@0.4/api/Unity.Rendering.RenderBounds.html But again these are pretty bare at the moment.
@unrealdevop
@unrealdevop 3 года назад
Can't find it, was really interested in it but I enabled previews and neither of the packages showed up. Someone said that you had to install the beta version of Unity to use it?? Weren't they showing Demo's of this system like over 10 years ago? They still haven't introduced it as part of Unity yet? I tried looking under it with Show Preview Packages enabled under both 2019 and 2020 and in neither cases would it come up.
@GameAcademySchool
@GameAcademySchool 3 года назад
In Unity 2020, the DOTS preview packages are hidden. You have to add them either by URL (plus icon in top left) using the GitHub URL. Or just edit the manifest.json with the URL and version number; it will reload the package once that updates. Just add the HybridRenderer; the rest of the packages will come automatically because of the dependencies.
@unrealdevop
@unrealdevop 3 года назад
@@GameAcademySchool Ah alright thanks, I'm interested to see it in action.
@nocultist7050
@nocultist7050 4 года назад
My subscenes flipout when I try do some static batching. Does DOTS not support it? I can live with that but I'd like to know if that is the thing... Can anybody help?
@GameAcademySchool
@GameAcademySchool 4 года назад
I don't think that works with the Hybrid Renderer. This thread may be helpful: forum.unity.com/threads/project-available-hybrid-renderer-sandbox.681142/
@abdiasj3692
@abdiasj3692 4 года назад
With this new system, it feels like we have to `spoonfeed` the entity it to the point we need to input everything it should use... wow...
@GameAcademySchool
@GameAcademySchool 4 года назад
Sorry, you don’t need to create Entities manually. Keep going in this series and you’ll see an easier way...
@abdiasj3692
@abdiasj3692 4 года назад
@@GameAcademySchool Ohhh Sweet! ~ Of course I need to watch the entire thing! this got me as this is the first video I see about the system. Thank you!
@jonathonistrainwreck4131
@jonathonistrainwreck4131 4 года назад
I have the things installed for it from the package manager but for some reason, unity doesn't recognize "using Unity.Entities;" and I don't know why?
@GameAcademySchool
@GameAcademySchool 4 года назад
Check if you conflicting versions of the necessary packages. Look at the dependencies next to Entities and Hybrid Renderer
@jonathonistrainwreck4131
@jonathonistrainwreck4131 4 года назад
@@GameAcademySchool Thank You! One of them was on a newer version, and it also doesn't help that visual studio code doesn't recognize it :P!
@sekharkarak6781
@sekharkarak6781 4 года назад
I am a beginner in coding and I don't have any knowledge in it... Do I need to learn C# before getting started with Unity DOTS...???
@GameAcademySchool
@GameAcademySchool 4 года назад
Draké Martinéz Yes, you definitely need some C# experience before learning DOTS. However, the advantage of starting out with it is that you don’t have to unlearn a lot of stuff. DOTS drops a lot of the object-oriented practices traditionally associated with game development in Unity
@sekharkarak6781
@sekharkarak6781 4 года назад
@@GameAcademySchool Thank you for your reply...🙂
@N1ghtR1der666
@N1ghtR1der666 4 года назад
someone correct me but this only seems useful for things you generate large quantities off, perhaps dynamically. I cant see how you could build a whole world using this when you cant even see anything till runtime? EDIT: Well I see the next video goes over this issue so perhaps not but definitely seems like a lot more work
@GameAcademySchool
@GameAcademySchool 4 года назад
The newer workflow allows you to work with your GameObjects in the Editor and then automatically convert them to Entities at runtime. The benefits extend beyond just spawning a lot of Entities. We do that just so you can see a concrete, measurable difference in FPS. But even if you only have a few objects onscreen, the more efficient DOTS way translates into less power usage (longer battery life if you're building a mobile game, for example). Yes, it would suck if you had to script everything manually every time you make an Entity. You don't. The Editor is getting workflow improvements to make following this new architecture easier. Probably I should have started with the easier/UI way to make an Entity and show the manual, scripted way a supplementary video.
@N1ghtR1der666
@N1ghtR1der666 4 года назад
​@@GameAcademySchool​is the UI way the next video in the series or is that elsewhere? also does converting a large scene of objects to entities at run-time cause extra load at run? also i imagine if you have a scene so large you need ECS then it would be hard on the editor anyway because you still have objects before run, would be great if you could cut out the middle make and interact with entities directly in editor
@GameAcademySchool
@GameAcademySchool 4 года назад
We cover one way using the ConvertToEntity utility in the Editor but that is the “older” way. There is something called SubScenes you can use that is more interactive. You can work with GameObjects/Entities in the Editor. You can split scenes into smaller SubScenes and work on one piece of the scene at a time. This allows for much more complex environments with more objects/Entities in your scene.
@pureay2700
@pureay2700 3 года назад
I hate that the rendermesh is only a shared component. Its so annoying for make procedural anything
@MrSkeleton14
@MrSkeleton14 3 года назад
Uh whats an "entity"
@stoneageprogrammer432
@stoneageprogrammer432 3 года назад
Thank you for explaining this. I'm just starting to learn about ECS after seeing the UniteLA unity MegaCity simulation video, which blew my mind. When thinking about Entities, you almost make it sound like astrophysics, and as if Entities are photons of LIGHT, with no mass, but with energy and speed and direction. Bad analogy I'm sure, but it's all I got right now. Anyway, watching more of your videos so that I can understand better. And that Entity Boilerplate does look terrifying. I start to wonder if a whole new language is going to come out of this some day... Maybe it should be called E!, since C# implies that we have reached the highest C we can have, and E stands for Energy in physics. "E=EC#" or something. I dont' know.
@MikevomMars
@MikevomMars 4 года назад
What the...? World.DefaultGameObjectInjectionWorld.EntityManager is even longer than the longest word in any of the major English language dictionaries (which is *pneumonoultramicroscopicsilicovolcanoconiosis* ) 🖐😮
@GameAcademySchool
@GameAcademySchool 4 года назад
Agreed. It used to be World.Active. But as the ConversionWorkflow was added, I think the term became inaccurate. Technically I think “DefaultGameObjectInjectionWorld” is more accurate if terrible to type. It refers to that default intermediate world used for conversion.
@michaelbeee3801
@michaelbeee3801 3 года назад
Well, the title suggests creating ONE Entity (an Entity - simple cube), but you are using an archetype that suggests multiple entities of the same type. Would be great to inform the watcher how to make it without an archetype.
@MegaGrant1988
@MegaGrant1988 2 года назад
An archetype is created to indicate which components the entity will have. If the archetype is not created, how can you add any component?
@radenzito
@radenzito 4 года назад
AWESOME TUTORIAL, but... what a pain in the a** is programming in DOTS... wtf... In the moment he said "You can't manipulate an entity from the Scene view my mind deleted DOTS as a viable method. NOT ARTIST FRIENDLY!!! it is worth it if you do ALL being a programmer, but if you have multiple artists withouth knowledge of programming this is not worth it...
@GameAcademySchool
@GameAcademySchool 4 года назад
radenzito sorry I should have showed you guys the SubScene Conversion first. Much easier. This is for folks who want the specific steps. Anybody can convert a GameObject to Entity using the UI...
@radenzito
@radenzito 4 года назад
AWESOME TUTORIAL, but... what a pain in the a** is programming in DOTS... wtf...
@sparrowhawk81
@sparrowhawk81 4 года назад
lol is anyone actually able to make anything useful or finished out of this DOTS shit? Why is everyone so obsessed with it? What even is Unity? Is it a fleshed out game engine or is it just a platform for people to make and sell "Assets" on or have a Patreon where they make tutorials? What a joke.
@GameAcademySchool
@GameAcademySchool 4 года назад
You're right. You can get by just fine in Unity without DOTS. It's actually quite hard to build a complete game in DOTS right now. But the industry has sort of been moving this direction for a while, so the hardware can be used more efficiently. Though it's kind of painful to go through all of these steps to do basic stuff for the moment, eventually there will be a payoff in a couple of years when the UI and feature set catches up with the underlying architecture. People are obsessed with it, because it's a bit of learning curve and we need to get ready...
@MikeCroswell
@MikeCroswell 4 года назад
@@GameAcademySchool Totally agree with you both on this. It is a PITA! It is like going back 40 years to Assembly on a 80286. DATA in one part. Code in another. Efficient. Kind of fun in a geeky way but really not an efficient or maintainable way to code. I play with it now and then (like watching this video) but assume most of this will get "wrapped" and we can use the higher-level way to code with components and still some OO. @Sparrowhawk I think when it comes to performance it is quite amazing and fits some of the paradigms the old console programmers like. PS: Thanks @Game Academy.school for making this. @Sparrowhawk thanks for speaking up about the (cute but big) "elephant in the room." :-)
@GameAcademySchool
@GameAcademySchool 4 года назад
Mike Croswell I think I should have started with the Conversion Workflow video. Day-to-day usage is quite a lot less work. You only need to do this “Pure ECS” approach when you need some custom tweaking.
@MikeCroswell
@MikeCroswell 4 года назад
@@GameAcademySchool Okay. I'll go check out your other video. Thanks much. For "fun", I''ll likely finish this tutorial first. FYI: I used this stuff with Zenject (sp?) last summer with a team. I did not like it at all. It reminds me of some of the old Microsoft COM OLE and even DirectX stuff where you are not actually learning science but someone's loosely collected bunch of code. It's like Unity had this shoved down their throats by someone and they don't seem to have a controlled access point. LIke 100 people were all working on creating these technologies and someone (mostly through luck!) was able to string it altogether. I mean, just look at how obfuscated it is just to create an entity. The paradigm should match Unity's normal one. You'd use attributes to mark the the data you want to parallelize like this; [DATA COMPONENT] and then do the same for the code, eg, [CODE SYSTEM]. For creating entities, they could have EntityManager have access to the World and so you should be able to just say EntityManager.CreateEntity instead of asking the World via the default mess. Really odd. Anyway, thanks for letting us bitch. :-)
@GameAcademySchool
@GameAcademySchool 4 года назад
@@MikeCroswell Yeah there are definitely a lot of people working on DOTS now. My guess is that they took a hard look at what they have and they have no other way forward to stay competitive. Their original architecture, while easy for users, is ultimately holding them back. It will be a painful transition that will take a couple more years I think before the new one is attractive enough to replace the "classic" one. But we'll see. I've been trying to keep an open mind about it. It's way way easier than it was a year or two ago.
@stalkerkk
@stalkerkk 4 года назад
Why unity bragging about ECS and efficiency, now hardware can emulate ps3 and xbox 360 games 60 games, most of them are even killzone, gears, halo ,red ded 2 still more complex than current unity best games, now hardware do not care about efficiency anymore.
@GameAcademySchool
@GameAcademySchool 4 года назад
All developers care about efficiency. You don't NEED to use DOTS or ECS if your game isn't high performance. But even for a simple game, efficiency means less stress on the hardware; for example, a comparable DOTS game will use less battery life on a mobile platform.
Далее
Unity DOTS: Conversion Workflow
15:55
Просмотров 22 тыс.
Unity DOTS: C# Job System
19:47
Просмотров 20 тыс.
O-Zone - Numa Numa yei на русском!🤓
00:56
Просмотров 122 тыс.
Unity DOTS: Components And Systems
18:50
Просмотров 16 тыс.
The moment we stopped understanding AI [AlexNet]
17:38
Просмотров 649 тыс.
Unity Job System - A Practical Code Example
13:50
Просмотров 81 тыс.
Factorio teaches you software engineering, seriously.
21:27
Unity DOTS: System Base
12:47
Просмотров 15 тыс.
A Competition for Unreadable Code?
12:33
Просмотров 156 тыс.