Your courses on Udemy and GameAcademy are excellent. I hope you continue updating this channel with more tutorials, a lot of game development student needs your content.
Thank you. I knew how to use an IComponentData,and Jobcomponent system, but I didn't know how to do a processing script for input. Now I do. Boss video. God bless.
Just noticed you have a new dots video super awesome !I'll watch it when im done with work I'm still waiting for the course man and please include physics with taging components man super Salute
Great tutorial. Thank you. And about that ConvertToInt32, if you disassemble System.ConvertToInt32(bool) you'll see that it uses a ternary operator, selecting between 1 and 0. So probably compiler will inline this and that will produce the exact code (:
Great Vid. I Just wanted to add that if you were to recreate this project in Entities 0.11.0, you can add the range attribute to the movementData.turnSpeed variable within the MovementData Component. I've not tried this in other versions, but I know it works with here.
I think the Translation component in the FaceDirectionSystem is not needed. I don't know if you still make videos, it's been a year since your last one, but I would love more DOTS content, especially since its changing so rapidly. I went through many videos, articles and documentation and your videos are the best thing I've come across regarding DOTS.
That is tricky right now. As far as I know, there is no supported way to do this and you have to make a workaround. I think you should be able to create an entity that you would control instead of the camera and have a monobehavior script that would apply the translation of the entity to the camera.
You don't necessarily need to use DOTS for UI work. You can use the existing "classic" system. Otherwise, you'll need to build your own UI System (which can be done but is more work obviously).
Animation is still work in progress. You can do it currently but controlling an animation controller/graph is, uh, not fun. I think it's best to wait for this part of DOTS to get fleshed out a little more. I suspect it will get much easier in the future.
For the inputs wouldn't it be easier if you just make them all int (instead of bool) then cast in the direction.x = right - left, direction.z = up - down ?
Hi Wilmer, I've been enjoying these tutorials. I'm following along and building my own project with the skills you're demonstrating. I'm trying to spawn entities with player input using the component system setup. I have an input data component and input system that both work in the entity debugger, but I'm struggling to see how to connect these concepts with the entity spawning concepts in your intro to ECS videos. Since the Spawner uses Monobehaviour to call the InstatiateEntity method, is that method not accessible through the SpawningSystem I built using SystemBase? Can the "SpawningSystem : SystemBase" send data to the "Spawner : Monobehaviour" to call a method? Like if upKey is pressed, spawn entity. I would think the spawn system handles the logic and calls the method by referencing the Spawner, but that doesn't seem to work. Do you know any resources that can help me understand this issue?
Correct. You won't be able to access the ECS/DOTS Systems from anything in the "classic" Monobehaviour world of Unity. The easiest way to "bridge" the two currently is make some public static methods on your Monobehaviour. These would be accessible by both ECS and classic. So use the static methods from within ECS and then respond from the Monobehaviour or vice versa.
Spike Liu it has nothing to do with ECS per se. it’s just a different, more flexible way of defining input. Unity already has a nice video on how it works
@@GameAcademySchool Thanks for the reply, finally got it working... Looking forward to your new course! I enjoyed your other courses on udemy, your way of teaching, especially when you use a graph while explaining works great.
So I tried this in unity 2020.2 and its not working. The spaceship in subscene Translation is not updating at all + dissappear from game, but if I add another spaceship in current scene ( not subscene) Translation is updating in entity but not moving in game. Any solution?
Okey, problem was in using URP, so either change your materials to Lit( or something like that) or enable Hybrid renderer V2, Project setting < Player < Scripiting define symbols < Add ENABLE_HYBRID_RENDERER_V2
I have 2 question 1.is it possible for put canvas in subscene and write a system to control everything? Just like(entity.foreach((ref image, ref someDataForfill_UI_Image)=> {}).Run(); And whem eventsystem selected,it will fill the UI image, Or also do more things , if it's possible to using this to control whole game UI? 2.entity.foreach can just foreach some part of entity instead of each entity? Or maybe That Won't make a big problem, then just forget it
Thank You! You Have Helped Me a Lot! But I do have a question: How do I apply It on an FPS game? I mean you are changing the object velocity relative to the World Axis, how do I make It so It uses the Local object axis (Z front of the object, X sides, etc)?
Hi. I'm running into the thing, that even with the finished project from your git, after installing versions of Entities and Hybrid renderer from this video, when I press play, the ship is not seen anywhere. With a ticked checkbox next to subscene in Hierarchy, I can see the ship, but after entering Play mode, it seen only in Scene, but not in the Game window. I'm using Unity 2020.2.1f1.
I could fix this in 2020 with allowing Hybrid Renderer V2 as described in this document: docs.unity3d.com/Packages/com.unity.rendering.hybrid@0.11/manual/index.html
@@Ankhtepot Another link that people might find useful, with the installation instructions to pass from Hybrid Renderer V1 (used in this project, older, no longer maintained) to Hybrid Renderer V2 (more recent and actively developed): docs.unity3d.com/Packages/com.unity.rendering.hybrid@0.11/manual/creating-a-new-hybrid-renderer-project.html#hybrid-renderer-v1
Sorry, I've had some obligations to attend to (work) and haven't had much time to record. It's been delayed, probably closer to end of summer. it may be all for the best, since Unity Physics continues to evolve. I suspect the DOTS core package has mostly settled down by now... but you never know...
One question, if I remember correctly, each component is stored in a different array, if this is true and we have many objects, wouldn't iterating through entities accessing various components increase the cache miss?
I had that thought as well, however, that does not seem to be the case. Component data is stored linearly, so MoveComponent - GlowComponent - ScoreComponent are all placed after each other, and then the next Entity starts with it's own components. So, whenever you're looping through all entities you'll prefetch the next entities in the array, and therefore have insane read speed and more or less completely avoid cache misses. I'm not sure why this doesn't happen in OOP as well... From reading a little, it seems like it is because OOP uses references, and pointers a lot, which scatters the data around. And of course, if data isn't linearly structured prefetching doesn't work. Here's some stuff about ECS software.intel.com/content/www/us/en/develop/articles/get-started-with-the-unity-entity-component-system-ecs-c-sharp-job-system-and-burst-compiler.html I believe struct of arrays is OOP with data oriented design... I don't think it'd really lead to cache misses, many arrays will fit in the cache.
The values for the moveData is not updating for me in the debugger. However, everything seems to work. Have I messed up a setting? For debugging purposes, it would be nice to see the values actually change... Im using Unity 2019.4.15f1
For those of you who are as stupid as me: The root cause was that my gameview was deselected when i was fiddeling in the entity debugger, so I just had to click anywhere in the game view to start moving again and see the values being updated
@@GameAcademySchool Doesn't that makes it much harder to procedurally generate stuff? How do you reference stuff in a subscene to build something? Like the cube example before. If you put a single cube into a subscene, how would you then increase it by however many you want?
@@cradle_of_chaos I dunno. I mean the core functionality of the packages is there. You can use the ECS, C# Jobs and Burst compiler just fine. They work really fast -- but they don't play nice with some features of the engine. If you have the manpower and know-how, that's enough. You can probably write what you don't have now. But if you're a solo dev, I would, uh, wait.
Thanks for this great video. For your player input if the point of DOTS is performance, is not better if you do this? byte a = 1, b = 0; moveData.direction.x = (isRightKeyPressed) ? a : b; moveData.direction.x -= (isLefttKeyPressed) ? a : b; moveData.direction.z = (isUpKeyPressed) ? a : b; moveData.direction.z -= (isDownKeyPressed) ? a : b;
Leo Salas ok fine but the savings here is minuscule. Since you don’t have a lot of player inputs and this runs on the MainThread not sure how much savings you expect. For me I will let it go in exchange for readability
Hey, Nice tutorial, but theres still a question which doesnt really fit into the ECS videos. How did you manage to install a RenderPipeline and ECS/Hybrid Renderer at the same time? I tried so many versions an different approaches but it just keeps crashing when i convert gameobjects with RenderPipeline materials into entities Can you pls tell me what you did there?
Rail Dex I didn’t do anything special at all. However, not all version numbers work with each other. Use the Package Manager to resolve version conflicts
Drag and drop doesn't work, because it says it can't find the file I just dragged and dropped... I guess I'll just have to go through this without any follow a long... a bit of a bummer, but it's still educational.
Using Unity 2019.3.14f1 When using the play button always locks down Unity and you have to use task manager to close Unity. I have added none of my own code, just followed the tutorial, the only change is the version of Unity itself. It also locks Unity down in random ways, and it seems like it is the sub-scene that is causing the issue.
@@GameAcademySchool I downloaded the complete project unzipped it and loaded it as a unity project, I changed nothing, I can run the subscene solo, but if I run the playerinput scene it locks up
What kind of weired behaviurs we can get if we use just Normalize or LookRotation instead of save variants? I feel like methods without save suffix should be safe by default and those that are unsafe should be suffixed with unsafe word.
You can't normalize a float3.zero (e.g. when you aren't holding the keys down). If you put an extra check if (!moveData.direction.Equals(float3.zero)) you can use regular normalize. The screen will blank out and won't show the player if you get a NaN error.
Most comprehensive ECS series on TH-cam right now. Really appreciate your effort.
Robert Lovelett thanks! Sadly not the most watched series :(
I like how you are going through every step in detail. Thank you for another great video!
Glad you liked it!
Your courses on Udemy and GameAcademy are excellent. I hope you continue updating this channel with more tutorials, a lot of game development student needs your content.
Thanks! I haven't had time to record in a while though I've been meaning to get back to it. Had bills to pay :)
Thank you. I knew how to use an IComponentData,and Jobcomponent system, but I didn't know how to do a processing script for input. Now I do. Boss video. God bless.
Just noticed you have a new dots video super awesome !I'll watch it when im done with work
I'm still waiting for the course man and please include physics with taging components man super
Salute
Yeah Tagging is probably next. Physics needs a lesson unto itself before we start using it.
So useful , thanks Wilmer 😊
Hi, would you consider making a video about how to do this using the new unity input system?
Great tutorial. Thank you. And about that ConvertToInt32, if you disassemble System.ConvertToInt32(bool) you'll see that it uses a ternary operator, selecting between 1 and 0. So probably compiler will inline this and that will produce the exact code (:
Can Karakuzulu yes, exactly.
Great Vid. I Just wanted to add that if you were to recreate this project in Entities 0.11.0, you can add the range attribute to the movementData.turnSpeed variable within the MovementData Component. I've not tried this in other versions, but I know it works with here.
Thanks for the info!
Wonderful tutorial!
I think the Translation component in the FaceDirectionSystem is not needed.
I don't know if you still make videos, it's been a year since your last one, but I would love more DOTS content, especially since its changing so rapidly. I went through many videos, articles and documentation and your videos are the best thing I've come across regarding DOTS.
what if you want mouse position data? for InputData?
Unity should be paying you for those tutorials.
Gregor Heinze Heh. Probably.
plz do a video that uses this with the new input system
How to control cameras and IU in DOTS?
That is tricky right now. As far as I know, there is no supported way to do this and you have to make a workaround. I think you should be able to create an entity that you would control instead of the camera and have a monobehavior script that would apply the translation of the entity to the camera.
Thanks for the well explained tutorial. How can you do mouse clicks on entities and UI using DOTS?
You don't necessarily need to use DOTS for UI work. You can use the existing "classic" system. Otherwise, you'll need to build your own UI System (which can be done but is more work obviously).
Ah, I see. Thank you!
Thank u for your sharing! I love your channel. could u tell me how to play the animation in the ECS
Animation is still work in progress. You can do it currently but controlling an animation controller/graph is, uh, not fun. I think it's best to wait for this part of DOTS to get fleshed out a little more. I suspect it will get much easier in the future.
Thank you!
What's the difference (pros and cons?) between ConvertToEntity and using SubScenes? When should I use which?
Use SubScenes. ConventToEntity is on the way out.
@@GameAcademySchool Thank you!
For the inputs wouldn't it be easier if you just make them all int (instead of bool) then cast in the direction.x = right - left, direction.z = up - down ?
how the fuck you have so little subs and views ?
Best ESC/DOTS series here !
How to print message to console when using Unity Tiny?
Hi Wilmer, I've been enjoying these tutorials. I'm following along and building my own project with the skills you're demonstrating. I'm trying to spawn entities with player input using the component system setup. I have an input data component and input system that both work in the entity debugger, but I'm struggling to see how to connect these concepts with the entity spawning concepts in your intro to ECS videos. Since the Spawner uses Monobehaviour to call the InstatiateEntity method, is that method not accessible through the SpawningSystem I built using SystemBase? Can the "SpawningSystem : SystemBase" send data to the "Spawner : Monobehaviour" to call a method? Like if upKey is pressed, spawn entity. I would think the spawn system handles the logic and calls the method by referencing the Spawner, but that doesn't seem to work. Do you know any resources that can help me understand this issue?
Correct. You won't be able to access the ECS/DOTS Systems from anything in the "classic" Monobehaviour world of Unity. The easiest way to "bridge" the two currently is make some public static methods on your Monobehaviour. These would be accessible by both ECS and classic.
So use the static methods from within ECS and then respond from the Monobehaviour or vice versa.
Awesome tutorial! Could you please teach how new input system works with ECS, I couldn't find anything online that teaches that. Thanks!
Spike Liu it has nothing to do with ECS per se. it’s just a different, more flexible way of defining input. Unity already has a nice video on how it works
@@GameAcademySchool Thanks for the reply, finally got it working... Looking forward to your new course! I enjoyed your other courses on udemy, your way of teaching, especially when you use a graph while explaining works great.
So I tried this in unity 2020.2 and its not working. The spaceship in subscene Translation is not updating at all + dissappear from game, but if I add another spaceship in current scene ( not subscene) Translation is updating in entity but not moving in game.
Any solution?
Okey, problem was in using URP, so either change your materials to Lit( or something like that) or enable Hybrid renderer V2, Project setting < Player < Scripiting define symbols < Add ENABLE_HYBRID_RENDERER_V2
I have 2 question
1.is it possible for put canvas in subscene and write a system to control everything? Just like(entity.foreach((ref image, ref someDataForfill_UI_Image)=>
{}).Run();
And whem eventsystem selected,it will fill the UI image, Or also do more things , if it's possible to using this to control whole game UI?
2.entity.foreach can just foreach some part of entity instead of each entity? Or maybe That Won't make a big problem, then just forget it
Thank You! You Have Helped Me a Lot! But I do have a question: How do I apply It on an FPS game? I mean you are changing the object velocity relative to the World Axis, how do I make It so It uses the Local object axis (Z front of the object, X sides, etc)?
Hi. I'm running into the thing, that even with the finished project from your git, after installing versions of Entities and Hybrid renderer from this video, when I press play, the ship is not seen anywhere. With a ticked checkbox next to subscene in Hierarchy, I can see the ship, but after entering Play mode, it seen only in Scene, but not in the Game window. I'm using Unity 2020.2.1f1.
I could fix this in 2020 with allowing Hybrid Renderer V2 as described in this document: docs.unity3d.com/Packages/com.unity.rendering.hybrid@0.11/manual/index.html
@@Ankhtepot Another link that people might find useful, with the installation instructions to pass from Hybrid Renderer V1 (used in this project, older, no longer maintained) to Hybrid Renderer V2 (more recent and actively developed): docs.unity3d.com/Packages/com.unity.rendering.hybrid@0.11/manual/creating-a-new-hybrid-renderer-project.html#hybrid-renderer-v1
When is the course coming out man?
Sorry, I've had some obligations to attend to (work) and haven't had much time to record. It's been delayed, probably closer to end of summer. it may be all for the best, since Unity Physics continues to evolve. I suspect the DOTS core package has mostly settled down by now... but you never know...
One question, if I remember correctly, each component is stored in a different array, if this is true and we have many objects, wouldn't iterating through entities accessing various components increase the cache miss?
I had that thought as well, however, that does not seem to be the case. Component data is stored linearly, so MoveComponent - GlowComponent - ScoreComponent are all placed after each other, and then the next Entity starts with it's own components.
So, whenever you're looping through all entities you'll prefetch the next entities in the array, and therefore have insane read speed and more or less completely avoid cache misses.
I'm not sure why this doesn't happen in OOP as well... From reading a little, it seems like it is because OOP uses references, and pointers a lot, which scatters the data around. And of course, if data isn't linearly structured prefetching doesn't work.
Here's some stuff about ECS software.intel.com/content/www/us/en/develop/articles/get-started-with-the-unity-entity-component-system-ecs-c-sharp-job-system-and-burst-compiler.html
I believe struct of arrays is OOP with data oriented design... I don't think it'd really lead to cache misses, many arrays will fit in the cache.
The values for the moveData is not updating for me in the debugger. However, everything seems to work. Have I messed up a setting? For debugging purposes, it would be nice to see the values actually change... Im using Unity 2019.4.15f1
For those of you who are as stupid as me: The root cause was that my gameview was deselected when i was fiddeling in the entity debugger, so I just had to click anywhere in the game view to start moving again and see the values being updated
is there a reason why you used subscene instead of convert to entity (just for my knowledge)?
Subscene is the preferred workflow. ConvertToEntity is eventually going away apparently
@@GameAcademySchool so subscene basically converts all of its children into entities automatically?
@@GameAcademySchool Doesn't that makes it much harder to procedurally generate stuff? How do you reference stuff in a subscene to build something? Like the cube example before. If you put a single cube into a subscene, how would you then increase it by however many you want?
Can you do a video with making a game that uses ecs, jobs and burst all together?
I put all DOTS videos on hold. It has been pushed off the immediate roadmap for Unity 2021, so waiting for it to mature a bit more
@@GameAcademySchool Do you think it means that none of the DOTS packages will get to verified status in Unity 2021?
@@cradle_of_chaos I dunno. I mean the core functionality of the packages is there. You can use the ECS, C# Jobs and Burst compiler just fine. They work really fast -- but they don't play nice with some features of the engine. If you have the manpower and know-how, that's enough. You can probably write what you don't have now. But if you're a solo dev, I would, uh, wait.
Thanks for this great video. For your player input if the point of DOTS is performance, is not better if you do this?
byte a = 1, b = 0;
moveData.direction.x = (isRightKeyPressed) ? a : b;
moveData.direction.x -= (isLefttKeyPressed) ? a : b;
moveData.direction.z = (isUpKeyPressed) ? a : b;
moveData.direction.z -= (isDownKeyPressed) ? a : b;
Leo Salas The ternary operator works out to be the same as Convert.ToInt32
@@GameAcademySchool yes but im using a byte instead of int32, 8 bits is less than 32 bits
Leo Salas ok fine but the savings here is minuscule. Since you don’t have a lot of player inputs and this runs on the MainThread not sure how much savings you expect. For me I will let it go in exchange for readability
Hey,
Nice tutorial, but theres still a question which doesnt really fit into the ECS videos.
How did you manage to install a RenderPipeline and ECS/Hybrid Renderer at the same time?
I tried so many versions an different approaches but it just keeps crashing when i convert gameobjects with RenderPipeline materials into entities
Can you pls tell me what you did there?
Rail Dex I didn’t do anything special at all. However, not all version numbers work with each other. Use the Package Manager to resolve version conflicts
Drag and drop doesn't work, because it says it can't find the file I just dragged and dropped... I guess I'll just have to go through this without any follow a long... a bit of a bummer, but it's still educational.
If I would use the new Dots Physics I would use the PhysicsVelocity instead of Translation? Dots is adding so much stuff im confused ._.
Yes, if you wanted a Physics-based controller.
@@GameAcademySchool Thanks! Yeah I want to play a little bit around with 3D :D My sub is yours
Using Unity 2019.3.14f1 When using the play button always locks down Unity and you have to use task manager to close Unity. I have added none of my own code, just followed the tutorial, the only change is the version of Unity itself. It also locks Unity down in random ways, and it seems like it is the sub-scene that is causing the issue.
I was able to download the final project from GitHub and upgrade Unity to 2019.3.14f1 safely. It seems to function okay.
Kelso Sharp are you using the same package versions or something else?
Game Academy.school everything is the same, only used the starter project from github not the completed one.
@@kelsosharp2170 Does the final project hang on your machine? The Starter version is the same repo so not sure why it would cause Unity to hang.
@@GameAcademySchool I downloaded the complete project unzipped it and loaded it as a unity project, I changed nothing, I can run the subscene solo, but if I run the playerinput scene it locks up
Still getting the hang of C#, then..... dun dun diiiiin! This.
I am so upset that other people's tutorials show up when searching, instead of yours.
What kind of weired behaviurs we can get if we use just Normalize or LookRotation instead of save variants? I feel like methods without save suffix should be safe by default and those that are unsafe should be suffixed with unsafe word.
You can't normalize a float3.zero (e.g. when you aren't holding the keys down). If you put an extra check
if (!moveData.direction.Equals(float3.zero))
you can use regular normalize. The screen will blank out and won't show the player if you get a NaN error.
im watching from the future and i have to say no it did not 1:20
Trigen Moon glad to know, it’s still fresh :)