Wow, thank you! That really means a lot. I'm trying hard to strike a good balance between informative and entertaining. I'm presenting a lot of things I think go undeserved by a lot of other channels, and honestly my content for these videos are mostly from things I'm using day to day during development - stuff I wish I'd learned\heard about when I was first getting started. So I'm really glad you're finding it useful! Thanks for the kind words! 😊
Your content is amazing. I'm so tired of the same beginner how-to stuff that ends up being a pile of spaghetti code and can't really be used in medium to large projects. This was much needed. Thank you and keep the videos coming! ❤️🙏🏼
@Vinton Cerf If you want to make sure the right object handles an event, you can assign the event to a delegate in a Dictionary. Then, when the event is triggered, you can specify which object to call the function on using its instance ID. This way, you can make sure that the function is only called on the specific object you want.
This system is not performant since he is id checking for every single door in the scene. Let's say we have 1000 doors in the scene. The id checking code will run 1000 times whenever a single door is opened. In other words, we say the following to the computer: You: "Hey dude can you open this door for me please?" PC: Wait pal, first I need to know which door is that what's the id? You: The id of the door is 0. PC: Ok just wait while I'm comparing that value to all thousand doors.
This is the BEST Unity event tutorial I've seen so far! I've been looking around for some practical, example based tutorials for understanding both the general use case and implementation details for event systems. It's a shame I had to watch so many other tutorials before I found this one, that in 5 min covered more than the previous five tutorials I've watched combined. Keep up your good work, and THANKS for this awesome video :)
The quality of this channel is unreal. Keep it up! If you're looking for suggestions on topics, it would be great to get some insight on project planning, scoping, and starting small for new developers (those most likely to find your videos useful).
Been learning C# on my own for a year now and so far, your videos have been the best for concise, step by step explanations. A lot of guides don't take the beginner mindset into account, and simply push forward into glossing over and including a lot of extra concepts that end up making things harder to understand. Cheers!
One of the clearest Dev tutors on KZclip! I love how you anticipate questions and problems, as well as giving a bit of top-level background to the code/unity concepts you are invoking. Top job fella!
@Maks Mikhnevych are you forgetting that for someone to subscribe, there has to be enough value in the content? The reason this KZclipr isn't as big is because this is the kind of content you're not going to be looking for to generally get better at unity. this solves a single problem in game development that some or most just don't really have a problem with yet or they have a system they think could be better. you have to be relatively experienced with the engine to want to watch this. frequency doesn't have to be in hz. the frequency this channel uploads is 1-2 videos per month. It's good quality content but it's not tackling a problem most have.
Zak Kaioken 2 Why would you try to explain me term introduced in conversation by me? If you want to go meta - the frequency this channel uploads video is about 0,000000578703704 Hz (videos per second) or 3 video each 2 month. Just look how rich looks your explanation on topic in one of the last messages. It is nowhere like your original silly point to low upload frequency being the reason of low subscribers count. If you take a guy who uploads more often then it would mean he will get 100k sooner than this channel, which is not true, according to your last improved post here. From our conversation it’s clearly obvious you have matured and became more aware of how things work and rarely will you have a chance to explain complicated process by single line of symbols starting with “That’s because”.
@Maks Mikhnevych Макс Михневич frequency has to do with how often one uploads. if you post every day you will have more content than the person who only posts once every couple months. I already gave you the formulae. you remember those / characters in my message those mean divide.
It took me a little while to wrap my head around this concept, but as my project grew bigger I really needed something like this! Now that I finally understand it I use it all the time! Thank you for explaining it properly and clearly!!!
A clear and concise video explaining events. I was self-taught with code, so I had been coding for a while before I started to understand events and how to utilise them. Even after learning about them, I still didn't really use them as I had to step out of my comfort zone. Really good explanation and usage to introduce someone to events though. Kudos!
That is so damn well explained. Short and sweet but without leaving out a single thing. You answered all my questions in record time. Thank you for the great video.
This was amazing. I think I need to come back when I'm not so sleep deprived, do a little background research, and try this out for myself to get the full benefit, but I didn't know about this functionality and never thought about programming this way. This is incredible. Thanks!
This has become one of my favorite design philosophies for quick prototyping, and even in some production builds over two years. I've used this for two major game jams, and it has amazingly reduced coding time drastically , although it can be a hard concept to grasp for other devs on short time span. I cannot recommend this tutorial enough. If you have trepidations about it, try it out, it might change your world as much as it did mine.
I want to thank you for the simple tutorial, it was pretty short, to the point, and showed off the syntax + a decent implementation (along with parameters) keep up the good work!
I’ve watched this several times and finally pushed myself to use it during a game jam. It worked so well for what I needed! Thanks for the concise explanation and example! It really helped me grow as a programmer.
Very nice video as usual. 👍 Your use case that you show in the video is not the greatest (better to use OnTriggerEnter() and OnTriggerExit() for doors in my opinion). Although, I know that this is just an explanation explaining how to make an event system using an observer pattern and for that it's simple and well edited. Nice job!
Overall great tutorial. One thought, Instead of assigning a Unique ID to each script, an easier way would be to get the gameobject.InstanceID, which would save time of needing to make sure each door has a unique ID.
@Nachos TV Nah, when passing GameObject as a variable you are passing only the reference to this gameobject. You are not passing all the data and variables that are included io this GameObject. So here, the most useful and easy way would be to pass GameObject.
You can also check if the value is 0 when the game starts, or in other words, you didn't already change it. If you didn't change it, assign its unique object id.
@Nachos TV When you send a GameObject (Or any variable for that matter) as a parameter to a method, it's only sending the pointer to the memory location, not the actual data. So it doesn't matter what type of data you send as parameters. At least not locally. There are slight differences in garbage collection and storage size for initialized variables. But nothing noticeable at such a scale. And since you're only sending a reference of the GameObject, you're not initializing anything anyway, so it's all good.
After a week, I came back here to say THANK YOU! This pattern is awesome, I just used it in an upcoming project, everything looks easy to understand, clean and safe!
im a CS master student who was always quite interested in game dev but in my bachelor and master we havent learned so much about game dev and looking at unity, i always felt somewhat overwhelmed with all the custom functions in unity. Just found your channel today and it gives me a nice starting point to at least see all the options in unity
Keep making amazing videos like this to explain kinda complex stuff simple...as an aspiring game dev I loved the video...you deserve more subs, I'll make sure to like,sub, refer, and tweet...keep up the good work.
I’ve been trying to achieve exactly what this video has explained for four days and not been able to until now. Earned a subscriber. First time I’ve come across your channel. Thank you!
Awesome video thank you! I've been wanting to make a much bigger event system which can be used on any sort of events, something like delegates in Unreal. This is a good starting point :)
Thank you for the video. Really helpful. Question: What are pros and cons of Event System as a separate class with all the events vs events scattered around in scripts?
Thanks for this video, I have seen a lot of event systems that didn't implement it with parameters, this was the first one that did! This really makes things a lot easier :)
Great video! Subscribed. One question: what is the difference between doing it this way and using UnityEvent and UnityAction in the UnityEngine.Events namespace?
THANK YOU! I come from a web dev background and build a lot of event-driven and/or event-sourced distributed systems. I've just started building a game as a hobby. SO, naturally, I decided to punish myself early and went looking for an event-based implementations in Unity. The first few forum posts and packages I came across made me doubt the entire approach, but this is precisely the kind of clean, simple, straightforward thing I LOVE! Thank you!
One other way that i manage events is to encapsulate them in a GameEvent scriptableObjects , then i create a GameEventListener script where i create a GameEvent field i can plug my event SO , and a UnityAction field for the listeners , i find that waay more flexible and more editor friendly. Good content man , this is helping many people get their code cleaner ! :)
Yeah, this is another great way to handle it, especially if you're working in the editor often or want designers to be able to set up relationships easily. I personally find it a bit messy, as it can be a lot harder to debug and understand the relationships at a glance. But there's never one right way to do something! Just whatever is best or easiest for the project at hand! Glad you enjoyed the video!
About Unity Events not depending on each other. I heard the same thing about Scriptable Objects, so that if you delete or disable the player or an enemy then your inventory doesn't go bonkers cause the player holds the code and variables to the inventory. Instead it's put in a Scriptable Object that's open to everyone to read from, making it much more flexible and easier to access without getting any errors while changing or testing new things
Hi Matt! I know it passed a while since you uploaded this, but I just knew your channel a week ago! And Im addicted now, I love this approach for non fully beginners, but still "followable" since all code is there. With regards to this video, let me ask you a question, implementing this has any impact on performance or is it more focused on clean and ordered code. In a project in an advanced state would be worth the effort? Thanks for the videos!
Thanks for the video! I found this pattern extremely helpful for triggering changes in the UI. Its very boring and messy to make direct connections between logic components and UI components. Using events you can just fire away upon input and let the needed components listen to it and do what they need to do.
Hey, cool tutorial. Thanks. Small question: Wouldn't it make more sense to make the whole GameEvents class a static class. It doesn't make much of a difference, I think. But maybe you have a reason for not using static classes?
Even thought I am using singletons for years and events as well, I never thought to use singleton as an intermediate system between two codes. Awesome tip, thank you so much and I hope one day you will resume working on your channel!
Hi, cool video, but I recommend putting the subscribe/unsubscribe lines of code in the Enable/Disable methods, because unless you call DestroyImmediate you don't really know when the object is destroyed.
Best practice in Unity is to handle event subscribes / unsubscribes in OnEnable and OnDisable, since those are invoked when Start and OnDestroy is called anyway, but it also allows you to cleanly enable and disable the game objects.
Hello, I have a silly question. The OnDoorWayOpen(int id) function will be called n times (n = the current door numbers) when only one is the right one. Isn't that considered low performance compared to directly save the door's gameObject reference on the trigger area component? I wonder when should I use the event-system and when should I directly save the reference. I also wanna ask how to set the Func returnEvents. :3 I am also working on solving it by myself. Thanks! Awesome video btw!
Thanks a lot! I was having an issue with Unity crashing when some events happened, so I watched this video to check what was wrong with my code. Your example worked perfectly. Later I realized that the problem was an infinite recursion lol
Would this be added along with a game manager? If so is it any different how the event system notifies the game manager compared to other classes since the game manager is also a singleton? I would really love to implement the event system in the future!
This was great! My computer science education is 25 years old, and I'm pretty new to C#, but I was able to follow this lesson the first time, get it all working, and understand the basics. It wasn't clear to me why we needed both the public methods and the public events defined in the GameEvents object, but a few edits to try to call the events directly from the TriggerArea objects showed me via C# errors that this isn't allowed.
Are there drawbacks of using too many events? Also should I make this event class a singleton as well (with DoNotDestroyOnLoad()), if there are multiple scenes in the game?
I've been trying forever to understand events. I finally think I understand it. May you have many blessed days and may your descents know nothing but happiness
Very good video. I've been struggling with almost the same problem for quite some time and I've come up with exactly the same solution. I wonder, is there any way to get rid of the ifs with ids? My idea is to listen only to the event of one particular door you are close with because if you had too many doors it doesn't make any sense to trigger the event for all of them every time player comes near. But I have hit the same problem - the event is the same for all of the doors so they all open... any ideas? Opening of door isn't of utmost importance to me but I have many units with hp in my game which if goes
What's the biggest difference to using this over regular delegates? I only found an answer that Unity Events have restrictions and used for the editor to serialize the events
Does this mean i have to make separate script/class for each listener if they each look for different events ? is there a way to create one listener class that can be used to select different events in the inspector (maybe through an enum) from the "GameEvent" class ?
I'm new to Unity, but I'm watching lots of different tutorials and going through an osmosis phase in my learning. Can someone explain the difference between doing this vs using scriptable objects? Thanks!
I've got a really dumb question. For a provided example, wouldn't it be simpler to handle door functionality locally in a door-specific script? Alongside a trigger maybe.
This is really great and very concise. You have quickly become my favourite Game Dev channel on here.
Wow, thank you! That really means a lot.
I'm trying hard to strike a good balance between informative and entertaining. I'm presenting a lot of things I think go undeserved by a lot of other channels, and honestly my content for these videos are mostly from things I'm using day to day during development - stuff I wish I'd learned\heard about when I was first getting started. So I'm really glad you're finding it useful! Thanks for the kind words! 😊
Your content is amazing. I'm so tired of the same beginner how-to stuff that ends up being a pile of spaghetti code and can't really be used in medium to large projects. This was much needed. Thank you and keep the videos coming! ❤️🙏🏼
@Vinton Cerf
If you want to make sure the right object handles an event, you can assign the event to a delegate in a Dictionary. Then, when the event is triggered, you can specify which object to call the function on using its instance ID. This way, you can make sure that the function is only called on the specific object you want.
@2n9 why?
@Vinton Cerf that's not true at all
This system is not performant since he is id checking for every single door in the scene.
Let's say we have 1000 doors in the scene. The id checking code will run 1000 times whenever a single door is opened. In other words, we say the following to the computer:
You: "Hey dude can you open this door for me please?"
PC: Wait pal, first I need to know which door is that what's the id?
You: The id of the door is 0.
PC: Ok just wait while I'm comparing that value to all thousand doors.
This is the BEST Unity event tutorial I've seen so far! I've been looking around for some practical, example based tutorials for understanding both the general use case and implementation details for event systems. It's a shame I had to watch so many other tutorials before I found this one, that in 5 min covered more than the previous five tutorials I've watched combined. Keep up your good work, and THANKS for this awesome video :)
The quality of this channel is unreal. Keep it up! If you're looking for suggestions on topics, it would be great to get some insight on project planning, scoping, and starting small for new developers (those most likely to find your videos useful).
Been learning C# on my own for a year now and so far, your videos have been the best for concise, step by step explanations. A lot of guides don't take the beginner mindset into account, and simply push forward into glossing over and including a lot of extra concepts that end up making things harder to understand. Cheers!
One of the clearest Dev tutors on KZclip!
I love how you anticipate questions and problems, as well as giving a bit of top-level background to the code/unity concepts you are invoking. Top job fella!
I like how you explain the concept first. It actually helps to teach us how to code, not just show us what you did.
How do you not have like a 100k subs already? Your videos are so nice and high quality!
Thanks!
Strange...
He forgot to remove OnDestroy... Ba dum ts
@Maks Mikhnevych are you forgetting that for someone to subscribe, there has to be enough value in the content? The reason this KZclipr isn't as big is because this is the kind of content you're not going to be looking for to generally get better at unity. this solves a single problem in game development that some or most just don't really have a problem with yet or they have a system they think could be better. you have to be relatively experienced with the engine to want to watch this.
frequency doesn't have to be in hz. the frequency this channel uploads is 1-2 videos per month. It's good quality content but it's not tackling a problem most have.
Zak Kaioken 2 Why would you try to explain me term introduced in conversation by me? If you want to go meta - the frequency this channel uploads video is about 0,000000578703704 Hz (videos per second) or 3 video each 2 month.
Just look how rich looks your explanation on topic in one of the last messages. It is nowhere like your original silly point to low upload frequency being the reason of low subscribers count. If you take a guy who uploads more often then it would mean he will get 100k sooner than this channel, which is not true, according to your last improved post here. From our conversation it’s clearly obvious you have matured and became more aware of how things work and rarely will you have a chance to explain complicated process by single line of symbols starting with “That’s because”.
@Maks Mikhnevych Макс Михневич frequency has to do with how often one uploads. if you post every day you will have more content than the person who only posts once every couple months.
I already gave you the formulae. you remember those / characters in my message those mean divide.
Utterly fantastic, most tutorials available on youtube have serious pacing and clarity issues, and yet you made it look effortless.
It took me a little while to wrap my head around this concept, but as my project grew bigger I really needed something like this! Now that I finally understand it I use it all the time! Thank you for explaining it properly and clearly!!!
A clear and concise video explaining events. I was self-taught with code, so I had been coding for a while before I started to understand events and how to utilise them. Even after learning about them, I still didn't really use them as I had to step out of my comfort zone. Really good explanation and usage to introduce someone to events though. Kudos!
That is so damn well explained. Short and sweet but without leaving out a single thing. You answered all my questions in record time. Thank you for the great video.
This was amazing. I think I need to come back when I'm not so sleep deprived, do a little background research, and try this out for myself to get the full benefit, but I didn't know about this functionality and never thought about programming this way. This is incredible. Thanks!
This has become one of my favorite design philosophies for quick prototyping, and even in some production builds over two years. I've used this for two major game jams, and it has amazingly reduced coding time drastically , although it can be a hard concept to grasp for other devs on short time span. I cannot recommend this tutorial enough. If you have trepidations about it, try it out, it might change your world as much as it did mine.
Your tutorials are so simple and understandable, keep doing this!
Welp, this was one of the most helpful videos for GameDev in unity. Clean, fast and simple tutorial. Great job!
he goes faster than a minecraft dream speedrun but it's very helpful!
I want to thank you for the simple tutorial, it was pretty short, to the point, and showed off the syntax + a decent implementation (along with parameters) keep up the good work!
This was great. To the point. Quick typing. No extra fluff. Loooove it.
I’ve watched this several times and finally pushed myself to use it during a game jam. It worked so well for what I needed! Thanks for the concise explanation and example! It really helped me grow as a programmer.
Really need more content like this which focuses on code and architecture
Very nice video as usual. 👍
Your use case that you show in the video is not the greatest (better to use OnTriggerEnter() and OnTriggerExit() for doors in my opinion). Although, I know that this is just an explanation explaining how to make an event system using an observer pattern and for that it's simple and well edited. Nice job!
Overall great tutorial. One thought, Instead of assigning a Unique ID to each script, an easier way would be to get the gameobject.InstanceID, which would save time of needing to make sure each door has a unique ID.
@Tom Tomkowski Thats pretty lit
@Nachos TV Nah, when passing GameObject as a variable you are passing only the reference to this gameobject. You are not passing all the data and variables that are included io this GameObject. So here, the most useful and easy way would be to pass GameObject.
You can also check if the value is 0 when the game starts, or in other words, you didn't already change it. If you didn't change it, assign its unique object id.
@Nachos TV When you send a GameObject (Or any variable for that matter) as a parameter to a method, it's only sending the pointer to the memory location, not the actual data. So it doesn't matter what type of data you send as parameters. At least not locally.
There are slight differences in garbage collection and storage size for initialized variables. But nothing noticeable at such a scale. And since you're only sending a reference of the GameObject, you're not initializing anything anyway, so it's all good.
@Nachos TV I'm no expert either - but I imagine that these are reference types and you would't actually be passing the entire GameObject
Wow, what a clear, concise, and informative video. Absolutely amazing work, thank you!!!
This stuff is gold! I've watched a handful of your videos now and I'm astounded by how useful they are.
Please keep up the good work.
After a week, I came back here to say THANK YOU! This pattern is awesome, I just used it in an upcoming project, everything looks easy to understand, clean and safe!
Great tutorial! Accurate and clear description and great code. Well done! 👍🤓
im a CS master student who was always quite interested in game dev but in my bachelor and master we havent learned so much about game dev and looking at unity, i always felt somewhat overwhelmed with all the custom functions in unity. Just found your channel today and it gives me a nice starting point to at least see all the options in unity
Another step to go further with this is using scriptable objects to make things greatly modular. Unity has 2 nice videos about it
I've got to echo all the comments below, this is one of the quickest, clearest and most aesthetically pleasing dev tutorials I've seen on youtube.
I've been watching videos on events for days and this is the only video that actually explained it well enough for me to understand, thank you!
I'm having trouble digesting all this about patterns, and now you just made a key subject easy to understand, I really appreciate that.
Keep making amazing videos like this to explain kinda complex stuff simple...as an aspiring game dev I loved the video...you deserve more subs, I'll make sure to like,sub, refer, and tweet...keep up the good work.
I’ve been trying to achieve exactly what this video has explained for four days and not been able to until now. Earned a subscriber. First time I’ve come across your channel. Thank you!
I love your content.
Fast + clean + VERY usefull.... I never saw channel like this (most are too unprepared)
I really wish you success
Awesome video thank you!
I've been wanting to make a much bigger event system which can be used on any sort of events, something like delegates in Unreal. This is a good starting point :)
This is a great tutorial - though I typically use UnityEvents over C# events because of the easy integration with the editor
Thank you for the video. Really helpful. Question: What are pros and cons of Event System as a separate class with all the events vs events scattered around in scripts?
let me tell you, this just leveled up my overall coding pipeline, simple, concise a work of art this tutorial
Thanks for this video, I have seen a lot of event systems that didn't implement it with parameters, this was the first one that did! This really makes things a lot easier :)
The event system was doing my head in. But you solved it in 8 minutes amazing stuff!
Great video! Subscribed. One question: what is the difference between doing it this way and using UnityEvent and UnityAction in the UnityEngine.Events namespace?
THANK YOU! I come from a web dev background and build a lot of event-driven and/or event-sourced distributed systems. I've just started building a game as a hobby. SO, naturally, I decided to punish myself early and went looking for an event-based implementations in Unity. The first few forum posts and packages I came across made me doubt the entire approach, but this is precisely the kind of clean, simple, straightforward thing I LOVE! Thank you!
One other way that i manage events is to encapsulate them in a GameEvent scriptableObjects , then i create a GameEventListener script where i create a GameEvent field i can plug my event SO , and a UnityAction field for the listeners , i find that waay more flexible and more editor friendly. Good content man , this is helping many people get their code cleaner ! :)
Yeah, this is another great way to handle it, especially if you're working in the editor often or want designers to be able to set up relationships easily.
I personally find it a bit messy, as it can be a lot harder to debug and understand the relationships at a glance. But there's never one right way to do something! Just whatever is best or easiest for the project at hand!
Glad you enjoyed the video!
About Unity Events not depending on each other.
I heard the same thing about Scriptable Objects, so that if you delete or disable the player or an enemy then your inventory doesn't go bonkers cause the player holds the code and variables to the inventory. Instead it's put in a Scriptable Object that's open to everyone to read from, making it much more flexible and easier to access without getting any errors while changing or testing new things
What a great video mate. Love how you've animated it to keep it interesting. Cheers
This is high quality content! You cover topic that's actually important. Thank you
Hi Matt!
I know it passed a while since you uploaded this, but I just knew your channel a week ago! And Im addicted now, I love this approach for non fully beginners, but still "followable" since all code is there.
With regards to this video, let me ask you a question, implementing this has any impact on performance or is it more focused on clean and ordered code. In a project in an advanced state would be worth the effort?
Thanks for the videos!
Fantastic tutorial, keep up the great videos!
It's truly astounding how easy the internet makes learning these days. Thanks for the tutorial, my guy.
Thanks for the video! I found this pattern extremely helpful for triggering changes in the UI. Its very boring and messy to make direct connections between logic components and UI components. Using events you can just fire away upon input and let the needed components listen to it and do what they need to do.
This is great, sounds like combining Mediator pattern with Observer using Events and Singleton. Nice
Hey, cool tutorial. Thanks.
Small question: Wouldn't it make more sense to make the whole GameEvents class a static class. It doesn't make much of a difference, I think. But maybe you have a reason for not using static classes?
love the video format! I appreciate you speeding up the coding sections and highlighting actual gameplay functionality.
Even thought I am using singletons for years and events as well, I never thought to use singleton as an intermediate system between two codes. Awesome tip, thank you so much and I hope one day you will resume working on your channel!
Hi, cool video, but I recommend putting the subscribe/unsubscribe lines of code in the Enable/Disable methods, because unless you call DestroyImmediate you don't really know when the object is destroyed.
Best practice in Unity is to handle event subscribes / unsubscribes in OnEnable and OnDisable, since those are invoked when Start and OnDestroy is called anyway, but it also allows you to cleanly enable and disable the game objects.
I dont agree because a disabled object should be able to respond to events.
Incredible guide. Thanks, man!
This really made the way event systems work a lot more clear for me. Thanks a lot, hope you have a good day!
Great job ❤️ Big thanks!
Never before have I needed knowledge so badly without realizing it. Thank you for this!
Hello, I have a silly question. The OnDoorWayOpen(int id) function will be called n times (n = the current door numbers) when only one is the right one. Isn't that considered low performance compared to directly save the door's gameObject reference on the trigger area component? I wonder when should I use the event-system and when should I directly save the reference.
I also wanna ask how to set the Func returnEvents. :3 I am also working on solving it by myself.
Thanks! Awesome video btw!
Thanks a lot! I was having an issue with Unity crashing when some events happened, so I watched this video to check what was wrong with my code. Your example worked perfectly.
Later I realized that the problem was an infinite recursion lol
Finally someone that explains this clearly! Many thankd👍👍
Could the event system also be used to update UI scores if a player does a certain action? Or is this only used for handling collider actions?
This is really amazing. Thank you!
Great and clear! Thanks a lot!
Thanks for your work! Super helpful.
As for me, everything is simple and clear. Thank you very much
I love your vids man; you're an awesome teacher.
Maybe I am a bit late to thank you, but your video saved me hours of suffering... Thanks a lot! Keep up your good work!
A brilliantly constructed guide.
You can use the UnityEvent class to benefit from automatic Unity serialization, as well as null protection if your GameObject was destroyed.
Great quality of video! keep your work doing mate 🤜🤛
This was a great video! Adding this to my toolbox for sure!
I used to use a C# events before I learned about Unity events, but your video gives a new look on them. Thank you.
UnityEvents are pretty slow
Would this be added along with a game manager? If so is it any different how the event system notifies the game manager compared to other classes since the game manager is also a singleton? I would really love to implement the event system in the future!
This was great! My computer science education is 25 years old, and I'm pretty new to C#, but I was able to follow this lesson the first time, get it all working, and understand the basics.
It wasn't clear to me why we needed both the public methods and the public events defined in the GameEvents object, but a few edits to try to call the events directly from the TriggerArea objects showed me via C# errors that this isn't allowed.
Очень круто! Спасибо
Incredible tutorial. Thanks!
Are there drawbacks of using too many events? Also should I make this event class a singleton as well (with DoNotDestroyOnLoad()), if there are multiple scenes in the game?
I've been trying forever to understand events. I finally think I understand it. May you have many blessed days and may your descents know nothing but happiness
Very good video. I've been struggling with almost the same problem for quite some time and I've come up with exactly the same solution.
I wonder, is there any way to get rid of the ifs with ids? My idea is to listen only to the event of one particular door you are close with because if you had too many doors it doesn't make any sense to trigger the event for all of them every time player comes near. But I have hit the same problem - the event is the same for all of the doors so they all open... any ideas?
Opening of door isn't of utmost importance to me but I have many units with hp in my game which if goes
This was super helpful, thank you so much!!
All your videos are really good.Keep up the good work.
IT WORKED, THANKS I'VE BEEN LOOKING FOR THIS FOREVER, BUT NO TUTORIAL COULD EXPLAIN IT AS YOU DID
After 7 or 8 videos I finally got a focused video 😊 Thank you
I love your channel its so useful 🤩
Heaps of thanks, I figure it out! Please make more of these! This helps me in my assignment.
Thanks a lot! Managed to make a similar thing in Javascript thanks to this tutorial!
What's the biggest difference to using this over regular delegates?
I only found an answer that Unity Events have restrictions and used for the editor to serialize the events
Does this mean i have to make separate script/class for each listener if they each look for different events ? is there a way to create one listener class that can be used to select different events in the inspector (maybe through an enum) from the "GameEvent" class ?
So useful, thank you very much!!
What do you use for your presentation building? It's so nice.
I'm new to Unity, but I'm watching lots of different tutorials and going through an osmosis phase in my learning. Can someone explain the difference between doing this vs using scriptable objects? Thanks!
scriptable objects are a completely different thing , to my knowledge
It would be great if you could make a tutorial about Multiplayer games using Photon for Android platform. Thanks!
I've got a really dumb question. For a provided example, wouldn't it be simpler to handle door functionality locally in a door-specific script? Alongside a trigger maybe.
Thanks, you explained everything well :)
This was so helpful!! Thank you
Thank you for this video! You solved my problem in 8 minutes :)
Hey Man, thanks for Sharing the knowledge and supporting the community.. Cheers!