Data-Oriented Input in Unity ECS - DOTS + Input System 2023

  Рет қаралды 13,605

Turbo Makes Games

Turbo Makes Games

Күн бұрын

📌 Download the full project files: www.tmg.dev/ECS-InputSystem 📌
👨‍💻 Code/Scripts from this video: www.tmg.dev/ECS-InputSystem-Code 👨‍💻
💬 Come chat with other DOTS/ECS devs: tmg.dev/Discord 💬
🚧 Resources Mentioned 🚧
Input System Tutorials:
• How to use Unity's Inp...
• How to use NEW Input S...
Should You Use DOTS in 2023? - • Should You Use DOTS in...
UI in ECS 1.0 - • 2 Ways to use UI with ...
Systems in ECS 1.0 - • How to Use SYSTEMS in ...
💻 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 - DOTS + Input System
- 2:27 - Steps for Handling Input in DOTS
- 4:50 - Two Ways to Read Input
- 6:14 - Creating the Input Asset
- 10:08 - Continuously Reading Input
- 12:40 - Writing to the Input Component
- 14:20 - Moving the Player
- 15:50 - Event Based Input
- 17:54 - Resetting the Input Component
- 18:31 - Final Demonstration
🌐 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

Пікірлер: 93
@Unity3dCollege
@Unity3dCollege 10 ай бұрын
Awesome! Excited to start seeing all these tutorials on DOTS, may have to make the switch sometime soon :)
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
Ooooohhhh 👀👀👀
@evanfield6720
@evanfield6720 10 ай бұрын
Indeed, I was generating mineral fields (24K objects) in my game using monobehavior and a Poisson disc sampling algorithm to keep them dynamic and getting a baseline of 130 FPS, converted those over to ECS and got that baseline up to 397 FPS. It is well worth the learning curve to get it done just to allow high performance on lower end platforms.
@alexadach5507
@alexadach5507 10 ай бұрын
hey man I just want to say you deserve way more views/subscribers than you actually have. As someone learning ECS in 2023 your videos have been a godsend. Keep cranking them out, especially now that 1.0 is out. They're incredibly useful thank you.
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
Thank you so much for the kind words. Got plenty more videos coming 😀
@khh1990
@khh1990 10 ай бұрын
drink every time Turbo says "you know"
@TurboMakesGames
@TurboMakesGames 9 ай бұрын
You know, that sounds kind of dangerous 💀💀
@raulfernandez6735
@raulfernandez6735 10 ай бұрын
Grabbing my popcorn, here we go! 🍿
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
Hope you enjoy!
@jdigi78
@jdigi78 10 ай бұрын
Thank you SO MUCH for this. Been waiting for a good tutorial for some time 👍
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
Hahah it's been a long time coming 😀
@DapperDinoCodingTutorials
@DapperDinoCodingTutorials 10 ай бұрын
Thanks Johnny, I'm finally revisiting DOTS after a few years and these tutorials have helped me catch back up to the new way of doing things :)
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
Right on Nathan! Excited to see the cool things you make with it 😀
@BlackStrife3D
@BlackStrife3D 10 ай бұрын
Exactly what I needed when I needed. Thanks!!!
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
Nice, glad it helped!!
@epaezrubio
@epaezrubio 10 ай бұрын
I can't wait to put this into practice :) Thank you for your amazing contribution to the game development community! All your tutorials are excellent and this isn't an exception.
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
Thank you so much for the kind words. Can't wait to see where you take this 😀
@rogercabo5545
@rogercabo5545 10 ай бұрын
At times, I find myself pondering why we don't need to utilize a two-layer, double-pass authentication hybrid, unmanaged interop-dots-api just to access the value of a single button. A few years ago, I could code something like if (JS_Button.Xyz) and was immediately able to launch the logic - and it worked flawlessly right out of the box. Nowadays, in Unity, it feels like you need an advanced degree just to query a controller input. But thanks to spend so much effort into this topics! 👍
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
LOL! It certainly is more complicated, but it does have a lot of flexibility
@evanfield6720
@evanfield6720 10 ай бұрын
I have been lurking in the ECS world for a few years now waiting for a 1.0 before attempting a conversion due to the imminent codebase changes we all knew were coming. It is great to see you staying on top of it as most content is outdated coming in this new release of the ECS package. Kudos to you for sharing your journey with us for the last few years!
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
Thanks for the kind words! All the best if you do decide to give it a proper go now that 1.0 is out 😀
@koukaakiva
@koukaakiva 10 ай бұрын
Thanks for the tutorial. As for a suggestion you asked for at the end of the video, I would love to see some of your old tutorials updated for 1.0 (specifically the Unit Selection ones).
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
Awesome, glad to know you'd be interested in that. Currently working on something that uses some unit selection like this, so may be able to whip up a dedicated tutorial on that hopefully soon 😊
@DrGroo
@DrGroo 10 ай бұрын
Thanks for the tutorial. This was a great topic. It's not always obvious how to hook up non dots-specific parts of unity with the DOTS/ECS application model. This was a nice explainer.
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
Awesome, thank you so much for the kind words! Glad it was helpful 😊
@TriCombStudio
@TriCombStudio 10 ай бұрын
Was just attempting to convert my project to DOTS and wasn't confident in my approach, this helped clear things up. Thank you yet again. Lol
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
Awesome, glad to hear this was helpful to you 😊 And feel free to ask in the Discord if you're stuck on anything else in your conversion process - tmg.dev/Discord
@ericr4025
@ericr4025 10 ай бұрын
Really good tutorial. I've actually started implementing some DOTS systems for fighting game inputs, and this first system that stores the input and writes it to a component in the update is something I was guessing at. Reassuring to see someone with more experience land on something similar :)
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
Oh cool, sounds like a fun project! Feel free to share your progress in our Discord community if you'd like - tmg.dev/Discord
@amir._.nazarpour
@amir._.nazarpour 10 ай бұрын
thanks for this information
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
Sure thing 😀
@NeilDonkin
@NeilDonkin 10 ай бұрын
Very interesting to see how events are used in the ECS world. Thanks
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
Absolutely! Glad it was helpful 😊
@yudanaim6849
@yudanaim6849 10 ай бұрын
Very cool tutorial i would love to see more of it. You will be the new brackeys for ECS. :)
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
Plenty more coming soon 😀
@roffy4373
@roffy4373 9 ай бұрын
One day, someone will make a 100 hours compilation video with all the times you said "we're gonna go ahead", thank you for your work it helps
@TurboMakesGames
@TurboMakesGames 9 ай бұрын
Oh probably longer than that 😆😆
@Maskedmous
@Maskedmous 10 ай бұрын
The things I still find challenging is Animation and AI. 2 very important systems in any game. So for example in a city you would simulate lots and lots of citizen / traffic. Having citizen walk streets from one point to another considering traffic lights and cars etc.
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
Definitely agree on the importance of those features in any game. For animations, here are some of the current options available to you - forum.unity.com/threads/dots-animation-options-wiki.1339196/ And I definitely would like to approach the topic of some different AI implementations soon!
@MantridJones
@MantridJones 10 ай бұрын
Before we're gonna like the video, we're gonna go ahead and leave a comment.
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
Hahaha love it!!
@mayank4156
@mayank4156 8 ай бұрын
DOTS looks complicated for a beginner lol. Thanks for all the help! ❤
@TurboMakesGames
@TurboMakesGames 8 ай бұрын
haha indeed it can be quite complex, but it is worth it if you need the extra performance. Hoping these videos can make it more approachable though!!
@scrt9561
@scrt9561 10 ай бұрын
Great Job! I'm a huge fan of your content and hope you will help me add new features to my games as I build using ECS. I'll be in touch and comment with some new features I would like to see added that match my C# code in this player input system but I think I have all that I need thanks to your Full ECS 1.0 video. If not, I look forward to reaching out.
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
Awesome, so glad to hear it! Feel free to join our Discord community and share your progress/ask questions there as well! tmg.dev/Discord
@ppreshh
@ppreshh 10 ай бұрын
Super appreciate your content man. Very few ECS folks at the moment it seems. I'm still wrapping my head around all of it right now, and I've never really done DOD before. I think it would've helped to see you walkthrough your thoughts as you're writing out the code. I'm still missing here how your player object in the scene is being hooked up to the movement scripts. I assume it's because the GO's got that player tag component and more on it through some authoring process. Still making the mental switch from GO to entities in the scene hierarchy as well. I'm slowly getting there I think o.O
@ppreshh
@ppreshh 10 ай бұрын
Just saw you linked the project files! That should be plenty helpful. tytyty
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
Thanks for watching, good to know you'd be interested in learning some more about the main DOD concepts!
@StealthNinjaK
@StealthNinjaK 10 ай бұрын
Could you do a video on how you would use a mixamo character & animations in dots?
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
Definitely going to be doing some things on animation soon, so glad you'd like to know how to use a mixamo character 👍
@HeyWhoTheFuckAreYou
@HeyWhoTheFuckAreYou 10 ай бұрын
What about IK Animations in Unity DOTS? Will there be videos on this topic? As far as I understand, now you still need to use MonoBehaviour for this, since Animations Rigging itself is written in MonoBehaviour?
@SpiritedSeeker
@SpiritedSeeker 10 ай бұрын
Yeah, that's how I am doing it now. Syncing the transform and animator from ECS to the rigged animator that lives outside of the ecs world. I do it by instantiating the prefab on start and remembering the references by using class versions of the IComponentData (unmanaged components). Wayn has a tutorial about this.
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
That's correct. I definitely would like to put up some good videos on Animation in ECS in general, but good to know you'd like to learn about IK animations specifically
@evanfield6720
@evanfield6720 10 ай бұрын
You can actually bake in the animations into the Entity itself and progress them through code. There is a good asset out all ready that will allow you to accomplish this called "GPU ECS Animation Baker", It is pretty straight forward to use it and the video demonstration is sufficient enough to get it up and running. Here are the tutorial videos he made for the application of the asset, kzbin.info/aero/PLerop1JzrAobUF2d8Iafj5waqSq3Ib8k1, buying assets is of course just the prelude to dissecting the code in them to see the path that was used to accomplish the task.
@LukeClemens
@LukeClemens 10 ай бұрын
​@@evanfield6720That won't support IK. As far as I know the only DOTS option that supports IK is by synchronizing legacy game objects with ECS. The DOTS Animation Options Wiki lists a lot of options, but none support IK at the moment. The Kinemation framework from DreamingImLatios has it on the roadmap.
@Octamed
@Octamed 10 ай бұрын
So basically SystemBase is just a replacement for normal managers and non-dots type code in the main thread? Then you kind of trigger work via the already running entity systems?
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
That is one way to use them, yes. You'll also see in my recent UI video, I use them to invoke events to update UI.
@MarkChong
@MarkChong 10 ай бұрын
Would like to hear how to set up addressable assets for modding with DOTS and Steam Workshop
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
Sounds fun, thanks for the suggestion!
@boringkillerstudio5880
@boringkillerstudio5880 10 ай бұрын
That's Great Video, I have been following your tutorials on ECS. And I have implemented into Surviver Game that's looks good but Now I'm unable to add Animation I have tried many things but couldn't work for me. So could you please make a Tutorial on Human Animation in ECS it will be great help for many dev out there. Thanks
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
Awesome, that's super cool to hear about your game. Feel free to share your progress on our Discord if you want - tmg.dev/Discord Yep, animation is a topic I really should cover a bit more. For now, here is a good forum post detailing the current animation options available for ECS - forum.unity.com/threads/dots-animation-options-wiki.1339196/
@nickgennady
@nickgennady 10 ай бұрын
It would be cool if you showed how to do skeletal mesh animations using DOTS Maybe instead if there is no native way to do skeletal mesh in dots (even procedural animation) you can show us good practice of binding game object and it’s components to a entity in efficient way
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
Thanks for the suggestion! Animation is definitely an important topic, but one that I want to approach in the right way when I get to it. For now, here are some of the current available options - forum.unity.com/threads/dots-animation-options-wiki.1339196/
@jmguillemette
@jmguillemette 10 ай бұрын
Dumb question but what asset / material are you using to get the floor plane with correct 1x1 cubes on it?
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
Gridbox Prototype Materials! Free on the Unity Asset Store assetstore.unity.com/packages/2d/textures-materials/gridbox-prototype-materials-129127?aid=1101l9vRP Be sure to use it with ProBuilder so the texture tiles properly
@jerms_mcerms9231
@jerms_mcerms9231 10 ай бұрын
That input action listen ui bug is super annoying. Hope it's fixed soon!
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
For real!!
@JunkerJames
@JunkerJames 10 ай бұрын
Hoping w get gyro feed from controllers. Last time I looked it wasn't available. Had to use Rewired.
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
I know for sure you can look at gyro data for VR controllers, unsure about console controllers though
@JunkerJames
@JunkerJames 10 ай бұрын
@@TurboMakesGames yeah. I think there's some issues with official driver support. You kinda have to go down the route of reverse engineered drivers since there aren't ubiquitous standards yet. Ah well.
@UngodlyDev
@UngodlyDev 10 ай бұрын
is it easy enough to make the controls rebindable? right now im using the player input component on a gameobject for my controls and i can rebind the controls in the ui, can this same logic apply to that workflow?
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
Great question - Yes, but you'll have to go through some extra steps to support this. Here is a thorough tutorial that shows how to do this with the generated C# class - kzbin.info/www/bejne/inWTg2iuZd5_Zrs Also, it might be worth taking a look through the documentation on the input system and try some of those options - docs.unity3d.com/Packages/com.unity.inputsystem@1.6/manual/ActionBindings.html#changing-bindings Alternatively, you could use a managed data component, where you can store and reference your existing player input component in an ECS system. docs.unity3d.com/Packages/com.unity.entities@1.0/manual/components-managed.html
@UngodlyDev
@UngodlyDev 10 ай бұрын
@@TurboMakesGames thanks a ton
@SuperKemito
@SuperKemito 10 ай бұрын
Any tips/ideas how to work with animations when using ECS/DOTS?
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
Here are some of the current available options - forum.unity.com/threads/dots-animation-options-wiki.1339196/
@SuperKemito
@SuperKemito 10 ай бұрын
@@TurboMakesGames Thank you
@lmao01
@lmao01 10 ай бұрын
I'm a little cofused not with this simple example but with more complex input system where other things at the same time should be enabling and disabling some inputs. I.e. You have player movement input enabled at start. The input can be disabled by inventory and map. Then player opens up inventory ui so the ui forces to disabled. On top of it opens map. There is no change in input since its already disabled. Then it closes the map. The movement is enabled yet it shouldn't because the inventory is still on. What I have done is in singleton with public Dictionary disallowed; string is an action ID. I add every single component which disallows action. And refer with every steering component this the singleton. It works yet, It feels like I am doing something wrong. Like I am skipping input system package in some way. I was trying to search for this information yet everyone shows very basic cases with input system. Maybe not the correct place to ask it. Either way good work and thanks for the tutorials. ❤
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
Thanks for voicing your concerns for your use case. Unity's input system has a ton of features you can take advantage of that may be able to help you. For instance you can have different control schemes that essentially group individual controls a user has access to. So rather than disabling the full input asset, you can just change which control scheme is active at a given game state. Hope it helps your research into the input system!
@vakuzar
@vakuzar 10 ай бұрын
This is great! now lets make Vampire survivor XD ! or an RTS prototype could be cool.
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
I recently did make a Vampire Survivors clone! Try it yourself, it was a super fun exercise. I've got something in the works that I think you'll enjoy though 😊
@vakuzar
@vakuzar 10 ай бұрын
@@TurboMakesGames yeah! I saw that! looked so cool I wanted to try myself, but I don't know where to start on tutorials for ECS since I've been waiting for 1.0. Now that it's out I wanna dive in, but I feel like most resources are dated and might not be compatible. That's why a from scratch one is so interesting to me.
@alexpopov1902
@alexpopov1902 8 ай бұрын
can't see actor in webgl
@MrHandsy
@MrHandsy 10 ай бұрын
Would I be able to purchase some personal advice regarding ECS from you?
@TurboMakesGames
@TurboMakesGames 10 ай бұрын
Reach out to me via Discord or email and we'll see if we can work something out! tmg.dev/Discord contact at tmg dot dev
@andhikadimas6345
@andhikadimas6345 10 күн бұрын
too many time jump in script, i am confuse.
@Luciferdelight
@Luciferdelight 4 ай бұрын
What is the difference between what you are doing, i guess you are just coding everything yourself, but in the new input system you usually set an Player Input component on the player and choose behaviour, (Send messages or Invoke C sharp events) Is this unusable when you using dots and is that the reason you do what you do. And if not, what would you (or anyone in the comments) say you loose out on by not using the player Input component instead ? I really cant wrap my head around this Any answere is appriciated
@TurboMakesGames
@TurboMakesGames 4 ай бұрын
With ECS you can't use regular Unity components in the same way as game objects. There are ways you can reference Unity components from ECS, but for hooking into input events it ends up being even more cumbersome than what I've shown here. The biggest thing you lose out on is just the convenience of setting up things in the editor - which can be nice if you are working on teams where you want to give people the ability to tweak certain things about the input without having to open up the code.
@ashpats2
@ashpats2 4 ай бұрын
Why is it when I copy all the scripts into a fresh project I get errors, but when I download and launch your project on the same Unity version, it runs cleanly? ```InvalidOperationException: The previously scheduled job PlayerMoveJob reads from the ComponentTypeHandle PlayerMoveJob.JobData.__TypeHandle.__TMG_InputSystemTutorial_PlayerMoveInput_RO_ComponentTypeHandle. You must call JobHandle.Complete() on the job PlayerMoveJob, before you can write to the ComponentTypeHandle safely.```
@jayvander5770
@jayvander5770 2 ай бұрын
try adding Dependency.Complete() before calling SetSingleton( new PlayerMoveInput)...
@simleGuy
@simleGuy 24 күн бұрын
@@jayvander5770 tnx man.
Intro to DOTS Animation - Unity ECS Tutorial 2023
28:30
Turbo Makes Games
Рет қаралды 20 М.
Should You Use DOTS in 2024? (plus what is Unity ECS)
30:15
Turbo Makes Games
Рет қаралды 34 М.
ПЕЙ МОЛОКО КАК ФОКУСНИК
00:37
Masomka
Рет қаралды 10 МЛН
Do you have a friend like this? 🤣#shorts
00:12
dednahype
Рет қаралды 43 МЛН
Como ela fez isso? 😲
00:12
Los Wagners
Рет қаралды 26 МЛН
NO NO NO YES! (50 MLN SUBSCRIBERS CHALLENGE!) #shorts
00:26
PANDA BOI
Рет қаралды 102 МЛН
How to Use SYSTEMS in Unity ECS 1.0 - Unity DOTS Tutorial
23:54
Turbo Makes Games
Рет қаралды 16 М.
Why Stairs Suck in Games... and why they don't have to
11:24
Nick Maltbie
Рет қаралды 1,5 МЛН
When to use Entity Command Buffer in Unity ECS - [Unity DOTS]
11:53
The Hot Path Show Clips
Рет қаралды 1,2 М.
2 Ways to use UI with Unity ECS 1.0 - Unity DOTS Tutorial 2023
22:38
Turbo Makes Games
Рет қаралды 18 М.
Use Unity's Input System Like a Pro
24:48
Paridot
Рет қаралды 23 М.
An introduction to Shader Art Coding
22:40
kishimisu
Рет қаралды 905 М.
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 675 М.
How To Render 2 Million Objects At 120 FPS
14:57
Tarodev
Рет қаралды 134 М.
Unity's New INPUT SYSTEM | Unity Beginner Tutorial 2024
1:02:44
SpeedTutor
Рет қаралды 16 М.
ПЕЙ МОЛОКО КАК ФОКУСНИК
00:37
Masomka
Рет қаралды 10 МЛН