- Видео 96
- Просмотров 1 135 382
git-amend
Канада
Добавлен 5 мар 2023
Ready to master high-level Unity3D techniques?
Advanced Unity3D tutorials to help get your game in front of your playtesters faster!
Build your indie game like an expert with:
- comprehensive core mechanics
- programming patterns
- proper architecture
- software engineering principles
- advanced C# language features
Learn how to take your game from concept to playtest from a:
- Unity Insider & Certified Unity Professional Programmer
New videos with source code every week!
🔔 Subscribe and hit the bell to get notifications!
Advanced Unity3D tutorials to help get your game in front of your playtesters faster!
Build your indie game like an expert with:
- comprehensive core mechanics
- programming patterns
- proper architecture
- software engineering principles
- advanced C# language features
Learn how to take your game from concept to playtest from a:
- Unity Insider & Certified Unity Professional Programmer
New videos with source code every week!
🔔 Subscribe and hit the bell to get notifications!
Unity Input System Demystified: 3 Easy Workflows You Need to Know
Discover the three main workflows of the Unity Input System in this comprehensive guide designed to demystify its features and make them accessible to everyone. Learn how to use the Input Actions panel for project-wide actions and bindings, leverage the PlayerInput component for callbacks and multiplayer scenarios, and directly read device states for quick prototyping. Plus, explore the use of visualizers and on-screen controls to simplify testing and debugging, making your input handling smoother and more intuitive.
Want to support me? 😀
Buy me a coffee! ko-fi.com/adammyhre
🔔 Subscribe for more Unity Tutorials youtube.com/@git-amend
Discord: discord.gg/FDRZGQBBUC
#unity3d #gamedev #indiedev
▬ ...
Want to support me? 😀
Buy me a coffee! ko-fi.com/adammyhre
🔔 Subscribe for more Unity Tutorials youtube.com/@git-amend
Discord: discord.gg/FDRZGQBBUC
#unity3d #gamedev #indiedev
▬ ...
Просмотров: 4 452
Видео
5 MUST-KNOW Rider Features for Intermediate Game Devs!
Просмотров 8 тыс.19 часов назад
Professional Unity developers, level up your workflow with these 5 MUST-KNOW Rider features designed for intermediate game devs! This video covers Rider’s integration with Unity, starting with inlay hints that boost code readability and moving on to essential hotkeys like Shift-Shift, context actions for smarter coding, and navigate-to commands for quick access to what you need. We’ll also dive...
Generics vs. Inheritance: When to Use Each in Game Development
Просмотров 7 тыс.14 дней назад
Generics and inheritance are two powerful tools in programming, each with unique strengths and use cases. In this video, we explore their differences and practical applications, particularly in game development. You’ll learn when to leverage generics for type safety and code reusability, when inheritance excels for shared functionality, and how to combine the two effectively for cleaner, more m...
Fix Closure Issues in 10 Minutes and Boost Performance
Просмотров 6 тыс.21 день назад
Heap allocations can quietly sabotage your Unity game’s performance, especially when closures and delegates are used incorrectly. In this video, we dive into how closures capture variables, why this often results in hidden allocations, and the impact it has on your game’s smoothness. You’ll learn how to identify and fix these issues, with a step-by-step guide to creating a lightweight Closure s...
10 Useful C# Attributes for Intermediate and Advanced Game Devs
Просмотров 10 тыс.28 дней назад
C# Attributes are a powerful tool for customizing and extending the behavior of your code, especially in game development where performance and clarity matter most. In this video, we explore attributes that can elevate your projects to the next level. From controlling memory layouts with `[StructLayout]` and `[FieldOffset]`, to ensuring robust runtime behavior with `[NotNull]` and `[UsedImplici...
Clean and Extensible: Chain of Responsibility in Unity Projects
Просмотров 8 тыс.Месяц назад
Chain of Responsibility is a powerful design pattern that shines in Unity development for creating modular, extensible systems. In this video, we explore its application through two examples: a quest system that cleanly handles state transitions like starting, completing, and failing quests, and a debugging toolkit that processes logs, state saves, and null checks in a dynamic and flexible way....
Revolutionize Your Unity Game with Optionals and Monads
Просмотров 9 тыс.Месяц назад
Nullable types (`int?`), the `default` keyword, and the null-forgiving operator (!) set the stage for creating powerful Monads like Optional and Either in Unity. In this video, we dive into how these Monads can eliminate null checks, handle success and failure scenarios, and simplify branching logic. With practical examples, you'll learn how to implement Optional and Either to write cleaner, sa...
Code Like a Pro: Refactoring to Patterns!
Просмотров 11 тыс.Месяц назад
Clean Code starts here! In this video, we transform an tightly coupled Unity project into a clean, maintainable system using proven programming principles and patterns. Learn how to apply DRY (Don't Repeat Yourself) to eliminate redundant code, implement the Factory Pattern for scalable object creation, and refactor an unwieldy animation system. We’ll also introduce the Strategy Pattern for dyn...
Expression Trees in Unity: The SECRET to Flexible Game Logic
Просмотров 10 тыс.Месяц назад
Expression Trees in Unity unlock powerful runtime flexibility, enabling dynamic systems like modding, runtime scripting, and data-driven AI-areas where static tools such as interfaces or dependency injection often fall short. By treating code as data, Expression Trees let you dynamically create, modify, and execute logic during gameplay. In this video, we’ll show you how to harness Expression T...
Hierarchy Hack: Add Indicator Icons for EASY Debugging
Просмотров 6 тыс.2 месяца назад
By hooking into existing Unity Editor Events we can easily display custom information and icons at the Game Object level in the Hierarchy for fast debugging and easy problem solving - or displaying any kind of information you want. Want to support me? 😀 Buy me a coffee! ko-fi.com/adammyhre 🔔 Subscribe for more Unity Tutorials youtube.com/@git-amend Discord: discord.gg/FDRZGQBBUC #unity3d #gamed...
How to Serialize Interfaces in Unity (Drag and Drop Support)
Просмотров 9 тыс.2 месяца назад
Serializable Interfaces in Unity give you the ability to drag, drop, and serialize objects that implement a specific interface in Inspector fields, enabling powerful, type-safe assignments. Using a custom attribute, you can restrict assignments to components implementing a particular interface. Or use an open generic type that supports serialization of references, enforcing both base types and ...
Stack-Based Finite State Machine (Push Down Automata)
Просмотров 10 тыс.2 месяца назад
State Machine fundamentals are taken to the next level with Stack-Based Push Down Automata (PDA), where we explore the power of stack-driven control in game systems. In this video, you’ll learn how a PDA can manage complex behaviors by allowing states to push, pop, and peek through a stack of layered contexts, adding flexibility to any character or game system with historical depth. Whether res...
Using IMPROVED Animation Events in Unity
Просмотров 12 тыс.2 месяца назад
Unity Animation Events are useful but can be cumbersome to manage manually. In this video, we’ll show you how to enhance Unity's Animation Event system for better control and flexibility. You’ll learn how to use StateMachineBehaviour to trigger UnityEvents directly from animations, and how to preview animations in real-time within the Unity Editor. We'll also cover automating T-Pose resets for ...
RAYCASTING Made Insanely Fast for Collision Detection!
Просмотров 16 тыс.3 месяца назад
Optimizing Collision handling in Unity with Batch Raycasting! In this video, you'll learn how to efficiently manage projectile movement and collision detection using Unity's Job System and Burst Compiler. We'll use TransformAccessArray to optimize bullet movement and take advantage of parallel processing. You'll see how to split the workload across multiple threads, reduce performance bottlenec...
Insanely FAST Spatial Hashing in Unity with Jobs & Burst
Просмотров 8 тыс.3 месяца назад
Unity's Jobs System and Burst Compiler are powerful tools for optimizing performance in your projects. In this video, we build a dynamic spatial hashing system from scratch, demonstrating how to efficiently partition space and reduce unnecessary calculations. Learn how to set up parallel jobs, manage native memory, and visualize the grid-based spatial hash. This step-by-step guide is perfect fo...
Using Octrees and A* for Efficient Pathfinding
Просмотров 11 тыс.3 месяца назад
Using Octrees and A* for Efficient Pathfinding
Using and Customizing Unity's NEW Behavior Graph
Просмотров 29 тыс.3 месяца назад
Using and Customizing Unity's NEW Behavior Graph
Utility AI: Mastering Smart Decisions in Unity!
Просмотров 11 тыс.3 месяца назад
Utility AI: Mastering Smart Decisions in Unity!
Essential Elements of Cinemachine 3.1
Просмотров 10 тыс.4 месяца назад
Essential Elements of Cinemachine 3.1
UniTask: How It Replaces Coroutines, Tasks and Awaitable
Просмотров 18 тыс.4 месяца назад
UniTask: How It Replaces Coroutines, Tasks and Awaitable
Unity Player Camera with Obstacle Avoidance
Просмотров 4,2 тыс.4 месяца назад
Unity Player Camera with Obstacle Avoidance
Anatomy of an Advanced Player Controller
Просмотров 15 тыс.5 месяцев назад
Anatomy of an Advanced Player Controller
AUTOMATE Unity Project Setup (and 15 Essential Assets for 2024)
Просмотров 8 тыс.5 месяцев назад
AUTOMATE Unity Project Setup (and 15 Essential Assets for 2024)
3 Unity Tricks: Gravity Wells, Right Angle Flips, and Moving Platforms
Просмотров 7 тыс.5 месяцев назад
3 Unity Tricks: Gravity Wells, Right Angle Flips, and Moving Platforms
PlayableBehaviour - C# in Unity's Playable Graph
Просмотров 6 тыс.5 месяцев назад
PlayableBehaviour - C# in Unity's Playable Graph
Unity Playables is Actually a Game-Changer
Просмотров 45 тыс.6 месяцев назад
Unity Playables is Actually a Game-Changer
AVOID These Programmer Resume Mistakes!
Просмотров 6 тыс.6 месяцев назад
AVOID These Programmer Resume Mistakes!
It's EASY to think your code will always be UGLY!
Просмотров 9 тыс.6 месяцев назад
It's EASY to think your code will always be UGLY!
The last workflow is really similar to what I’ve been doing except I haven’t been leveraging the generated class, which looks like it handles a good deal of boilerplate for getting all the actions needed (I was manually getting all of them from serialized fields on my ScriptableObject). I’ll definitely try it this way next time. Thanks!
Glad you found it helpful, those generated classes really do save some time!
A great video as usual. Thank you!!
My pleasure!
Ever since the new Input system was released I've been using the third option, which is very useful. Though I did switch from having events with just the value to having events that also send the state, performed cancel etc, as I find it to be more flexible on the consumer side. As I had more complex inputs, having just the value became kind of a hassle. And having the ability so witch between action maps depending on the context.
Not a bad idea at all, thanks for the comment!
Do you think this package is a good solution for building a GOAP AI system? Or is it suited more for behavior trees?
It's more suited for systems where you need to setup a directed graph. You could use this to support a GOAP system, but you would need to be very familiar with the classes that make up the graph system and be able to extend it yourself.
@@git-amendYeah that makes sense. Thanks!
This video was very well-timed for my use, great quality content as always. Keep it up!
I'm glad it was helpful!
My biggest gripes about the new input system: 1. You basically HAVE to use the scriptable object workflow you described, otherwise you'll have to instantiate your action schema in each object you want to subscribe to events and call .Enable() .Disable() etc, not only it's a lot of cruft, but action schemas contain a ton of json which needs to be parsed on instantiation which is quite slow and allocation heavy. 2. I haven't found any way to prevent keyboard actions going through when typing into text fields, i.e. TMP_InputField. Fixing this required developing my own very hacky looking fix. 3. It's apparently trivial to set up bindings in such a way the editor allows them but it then errors out with internal exception in the input system (I.e. NPE) when performing an action. That's bananas. Great video, thanks!
I havent used all th UI portions of the input system as it was bad enough getting keys in the setup stage because it would do weird things.. I also tend to use rewired now
Wow! The video I asked for in the comments, thank you!
You're very welcome!
Nice overview! It does however miss the, in my opinion, best way to use the Unity Input System: By adding InputActionReference fields to your InputReader SO or component, you get an inspector field where you can assign actions. These assigned actions are serialized and robust and it is not necessary to use the compiled C# class from the action table, which I personally hate, since it triggers a recompile every tile you make a change to the actions - especially in early stages when you're still tweaking a lot this can be really annoying. The obvious advantage is of course that you can swap out actions from the editor easily or create different scriptable objects with alternate mappings, without having to write new classes.
Is Rider free for game programmers using collaboratively with Unity?
There is a non-commercial version that is available, but be aware that it shares some information with JetBrains and isn't meant for projects you intend to profit from.
Great tutorial, thank you. Are there any performance concerns for this approach? Say we use this across the whole game and reduce reference usage to a minimum, would that be efficient in a big project?
This one is great, I hadn't seen the "like the old input system" way of doing it before, still prefer your last version with the Scriptable object, but good to know the others
Glad you liked it! I agree, the SO approach is very flexible.
I’m having trouble following the link to the actions video. It seems to go nowhere! I’d love to see linked videos in the description
That's interesting, all videos that show up as cards should show up for you in the description as well, at the very bottom. The one about actions is the 3D Platformer series which goes into more detail about setting up an input scheme. There are other more detailed videos on YT about the topic as well.
I didn't know there was a way to make things like this. It's really amazing. Personally, I wish your Unity tutorials could be published as a book. Something like "Unity for Advanced Users." I study a lot with official Unity projects, but teacher(your) projects are always a step above.
Thanks for the kind words!
@@git-amend I also hope to one day develop my own code rather than just cloning teacher's code, but it's really challenging. Thank you for your great tutorials as always. However, what I want to ask is, I don't quite understand why "use Isolated Input Action" needs to exist. I don't understand why it has to be "only responding."
The reason is that the On Screen Control is trying to send events as the 'Gamepad' but at the same time your Mouse is also sending events. By isolating the control to only be the Gamepad input these two controllers won't fight with each other. If you don't isolate the control, you will experience jerky movement because both input controllers are publishing events at the same time.
@@git-amend Thank you so much. I couldn't figure out the reason just by watching the video. I am a huge fan of yours.
Thanks for the work you put in on these videos, some really helpful insights. I started using Unity just a short time before the Input system was released (or maybe just before I became aware of it?) anyway... I definitely am not a fan of change myself, so I understand the reservations people have about moving from one method of doing things to another, especially if you have a lot of experience with the current way of doing things. However I do find the new system to be pretty intuitive (after an initial learning curve) , I find it to be easier for me when it comes to supporting multiple input devices , just seems a little cleaner over all IMO.
You're welcome, and I agree 💯
I've been using the Scriptable Object approach ever since I saw Unity's Scriptable Object Architecture video. I'm a university student, and have only been using Unity since October, I really enjoy your videos (although sometimes they're a little complex for me)!
Thanks, and glad to hear it. We're going to have a video on SOAP coming up in a few weeks!
I love the new input system for its flexibility, but they really messed something up in Unity 6. For some reason inputs just stop working and require an editor restart every couple hours.
Interesting, I have not experienced this myself (not yet at least)
Great video! Definitely will check out those interfaces. I'm currently using your Event Bus to raise input events on a singleton InputManager. Using the interfaces to generate those methods will save some time wiring things up, thanks!
Fantastic!
There is also another workflow that allows you to subscribe directly to the individual input action assets. It's like the Interface/SO approach, but on a per-action basis.
I planned to just watch this video for my own entertainment without expecting to learn anything new but I ended up learning about a c# feature I did not know of at 2:50.
Nice, which feature was that?
@git-amend it was using delegate {} instead of null and ?.Invoke()
Great video! It's nice to see different ways of working with this system. When using the PlayerInput component, is there downside to subscribing to each of the InputAction's events directly? For example, playerInput.actions["Attack"].started += Attack();
This is great! After watching several other tutorials, only one mentioned the C# class, but your video offers a lot more depth and gave me a much better understanding. Thanks for all the insights!
Awesome, thank you!
Very very nice. Input reader as SO is hot. - I'd like to add that the samples for the input package are super useful, i.e. there is button remapping already in there.
Yes, I agree with that - all the samples are very helpful!
Great Video!
Thanks, I'm glad you liked it!
Very good overview. I like the way you abstracted the input allowing consumers to either subscribe to events that you forwarded on or properties. I actually got into a bit of a flame war following that very pattern in my Joust tutorial. Their primary hangup was that we basically have "a subscription within a subscription". i.e. you have a middle-man that's receiving the events from the input system forwarding those with events of its own. I actually made a follow-up video on abstracting user input explaining why that's a good thing.
A little abstraction never hurt anyone. I'm often surprised at how many game developers shy away from it, and from patterns like Facade.
Using a Scriptable Object for the Input Reader is genius! Never would've thought of that!
Great, hope that tip proves useful!
Which workflow do you tend to use and why do you prefer it over the other options?
I prefer the 3rd option with the Scriptable Object as it gives the most flexibility and is scene independent.
Amazing video as always! Would love to see a follow-up video on displaying input actions using the UI Toolkit and reacting to input device changes to update the bounded input actions.
Great suggestion!
I agree that this would be very useful. The input visualizer from the samples is nice, but having a nice and styled UI which shows the user the current inputs has proven incredibly useful in our current project (for the users themselves and the devs debugging, we show it on-screen during video captures of playtests to get an idea of what the user did)
solid tutorial! I've been using the scriptable object approach for a while and it's great if you want separate maps for different Input States (like on foot, in a vehicle, etc or KBM vs Controller). really helps only sending input data to only the current object you're controlling. Also I just got Rider after watching your vids the past few months, I am absolutely loving it and it's a huge upgrade from VS 2022, especially with hlsl cus it actually formats properly instead of being a jumbled mess in VS
Thanks for the comment! Rider is awesome, I'm really glad you enjoy it! I should have mentioned the shader support in my vid!
I also use a handler with SendMessage methods
Great one as always 🎉 Would u consider doing some XR stuff in the future?
Thank you! Might do some XR down the road, might be a good excuse to break out my HTC Vive again... or upgrade.
You are by far my favorite channel on RUclips when it comes to coding. You and Sebastian Lague are the best <3 Been watching for a very long time, I love to see that your channel is growing!
Wow, thanks! That is too kind!
Great Video! i want to ask where do you call the EnablePlayerActions? and i have a problem where i need to enable domain reload for it to receive input when you run it for the second time, do you have a solution for this? thank you!
Thank you. I usually enable the actions from my player controller in the Start method. As for your second question, I don't think I've ever experienced that issue, so maybe another subscriber has some advice or maybe it's a question for the Unity forum. Or Discord.
I have 5 characters with separate inputs. This will come in handy and your previous video as I get some input calls after new scene load with newest 2022.3 LTS. Is say I should Dispose()...preety sure after creating new inputs I disable them in OnDisable. So yeah... have to search for a solution ;) Happy Sunday thank you! <3
Interesting. Maybe take a look at the Unity 'Warriors' sample project. It's a few years old, but it was a demo for handling 5 different inputs at the same time. github.com/UnityTechnologies/InputSystem_Warriors
@git-amend thank you so much! Will do!
Thanks for the great videos as always. from south korea.
Thanks for watching!
Glad to see the channel growing! The Input system has always been a chore and a source of frustration for me. Especially when updated features will randomly break your workflow and cause bugs. This is great as a source for a tighter more streamlined work process to navigate. Thanks a ton for this!
Thank you and you're welcome!
Nice video! The only disadvantage I see with this approach is not being able to access the InputReader from non-MonoBehaviour scripts.
That's true. If necessary, you might want to just implement the interfaces as pure C# classes and serve them up from a Service Locator or DI, which would also be convenient.
As always, great video! Thanks a lot Adam! In my case I just don't know if it's ok to set the input package to Process Events in fixed update, then I have consistent input (50Hz) and synchronization with physical simulations for controlling the player via Rigidbody2D (with Interpolation). Is it okay, or can there ever be a problem with that? In my case everything works very smooth and properly. But, you always read input in update and transfer logic of physical movement into fixed update with Rigidbody, far as I saw in your videos? :)
You're welcome. Your approach is very interesting, I've never seen anyone do that before so I don't have a solid answer for you. I tend to store the value in Update because I'm often using it in other systems and not just for moving the character. For example, I set my blend value for the characters locomotion animation based on the movement input. So, I think the answer to your question is probably 'it depends'... or maybe 'if it works, it works!' Very interesting scenario.
Awesome! I didnt look into it too much because I always felt the prototyping is easier with the "old" system. Glad I can somehow use the "better"/"newer" system without the hassle and overload it seemed to imply. Direct reading FTW ^^
Yeah, the direct read is very convenient for that!
I've been working with the input system for a while now and never actually bothered to read past the wall of config to get to those interfaces lmao. Very informative, thanks!
Awesome, glad to hear that!
Happy Sunday! Thanks for the vid
Same to you!
Nice!
Thanks!
I create my own input reader. I create a ScriptableObject that I can store input action references in. I then throw that ScriptableObject into a custom input reader with some public methods that check the references when called. And finally I can check that input reader for inputs like the old input system. I keep swearing that I will swap over to the event version, but I'm lazy, and this works.
Interesting approach, and not too different from the 3rd workflow. I often prefer polling over events, especially for things like movement.
Haven't watched yet, but i can tell this is what i need, thanks
Awesome!
Never been this early lol. Also I never found a reason to use the new Input System but maybe this tutorial will serve as good introduction. Thanks !
Nice work! I hope you try it out! A little more complex, but hopefully this video makes it easy!
Happy Sunday! I have to go back to one of your videos on how to close/disolve supposedly non active input calls. Or ...I'll watch the video for answers here now ❤
Happy Sunday! I hope this video clears up any confusion about Unity's Input System-let me know your favorite workflow or if you have any questions below!
How to stop Unity infinite loop, like "while (true)" using Rider?
Attach the debugger to Unity, pause execution using the Pause button, and inspect the Threads and Call Stack to locate the thread stuck in the loop. Once identified, use the Evaluate Expression tool to modify a variable controlling the loop (e.g., set a condition to `false`) or drag the execution pointer outside the loop to skip it. Finally, update your code to prevent the loop from recurring, such as by adding better exit conditions. See: www.jetbrains.com/help/rider/Debugging_Unity_Applications.html
How could we update the shader to move it so the clouds scroll across the sky to give a bit of a cloud moving effect? :) could you share please?
I've got so many ideas on how I could implement these things into my game just watching this video. Another banger, extremely helpful!
Awesome, really glad to hear that!