Hey everyone! Stick around until the end of the video because I've stumbled upon some great (and FREE) 3D Platformer models that I can't wait to share with you that will help you develop your own 3D Platformer. Details in the video and link in the description.
Man you are very underrated, many tutorials show basic or beginner friendly code, but your tutorial shows more systems, or design in game developing which i have never ever heard, i hope your channel will grow bigger and thank you for all the tutorials
I was just rewatching and thought I'd let you know in case you didn't: Start can act as an IEnumerator, so instead of calling a function that starts a coroutine, you can just have Start wait one frame before doing anything. Obviously I would only use that if the class isn't very big and only has one or a few responsibilities, but I've found it useful a few times!
Loved this series of videos so much. Really taught me a lot about how to properly organize logic across my project and just so much more. Can't wait to dive into this channel even further now!
Still remember when I first learned about Scriptable Architecture, got so hyped that I wanted to get everything working as a Scriptable Object, until I noticed that I had more resources in the project than everything else... The drag and drop hell was also something that kept me away from this architecture... BUT, for quick prototyping, event channels, scriptable variables, runtime sets and some others are perfect to get things up and running fast!
A little heads up about using ScriptableObjects as "middlemen" to events if you intend to use the Addressables package: Depending on the addressables setup multiple instances of the SO might be created causing the events to be invoked in different objects wich makes it unreliable. The worst of this bummer is that this behaviour is only noticeable on builds. In the editor it works as expected.
Awesome content! I'm rewatching your Event Series for the 4th time! Just curious-could Event Channels cause scalability issues in larger projects with many channels? For example, designers might place channels incorrectly, or forget them entirely, as well as create new channels all over the place. When is it better to use an Event Channel over an Event Bus, or should they be used together?
Great question. It's my experience that users (in this case the designers) will always find a way to abuse the tools given to them or circumvent the limitations you place on them. So, while it's great to give them lots of flexibility, you should also keep an eye on it. Me personally, I would try to do as much in code as possible with the Event Bus, but you can definitely use them together.
I have a similar setup though I always just thought of them as events that anyone could just to listen to, instead of a channel. That's what I get for skipping college and building my career through experience instead :).
I could be wrong here but i belive UnityEvent dont need a safe check? before Invoke do they? 🤔 Nice content btw! I was wondering where did you get the name Event Channels from? I've seen this pattern has been called "Scriptable Events" withing unity community
You are correct; the UnityEvent system is designed to be null-safe when invoking events. If you invoke a UnityEvent and there are no listeners, nothing happens, and no exception is thrown. I think I forget that sometimes! As for the term Event Channel, it comes from a broader software engineering context, possibly from the book Patterns of Enterprise Application Architecture by Martin Fowler, which is sitting on my desk.
So i think i understand. Because we're using a scriptable object, it handles the registration and deregistration as a single instance... so this is essentially a decentralized event system, more or less. It's adhoc, not centrally managed. Am I understanding this?
Seems useful. Is there a specific advantage or reason why the EventChannels are scriptable objects, instead of just pure C# classes? From my understanding, the only real benefit of the ScriptableObject thing is Unity Inspector niceness (so, good if you have non-coders on your team).
Great question. Yes, the niceness factor is one good reason for using ScriptableObjects, but the primary reason I like this system is that ScriptableObjects exist independently of scenes, as they are assets rather than GameObjects. This allows them to be referenced and accessed across different scenes without issues. They won't be destroyed or invalidated when changing scenes, making them a good choice for managing data or functionality that needs to be shared or persistent across multiple scenes. You could do this with pure C# classes as well, of course, and I recently saw a pure C# EventBus implementation featured on GameDevDigest - it's worth having a look: github.com/pointcache/BasicEventBus
Awesome video as always. I'm having a problem with performance on the first time calling the unity event. The time goes up to 250 milliseconds, but only the first time, the next times the time is of 2 milliseconds at most. Do you have an idea of what could be causing this or how to solve it? Thanks in advance :)
@@git-amend Thanks for the quick answer. I was looking in the profiler, but I couldn't really figure out the problem. I will do more testing in other projects to see if I can narrow the issue. Thanks a lot, really appreciate your help (and your videos, of course)! :D
Just discovered your channel, and I’m soaking in a whole bunch of info atm. I got a noob question, near the beginning of the video, it looks like in your hierarchy you have a sandbox scene and a gameplay scene. Is there a reason why you do it this way? Instead of maybe having another canvas on top of the other objects to use as a UI? I’m very new, sorry for the dumb question.
In this video there are two scenes to demonstrate cross-scene communication. Normally you cannot send events to game objects in different scenes in Unity.
Hey! I’m really new to all of this and I just finished making a version of your file but I wanted a first person point of view on the character, how should i go about implementing that into the scripts/project without messing anything up? I figured I could look up a tutorial on how to make one in a statemachine but how would I put it into the one I have already?
The Event Bus is a completely decoupled system, so none of the users of the Bus need to have a direct reference to the Event Bus to use it, and it can handle any type of Event. On the other hand all the users of an Event Channel need to keep a reference to the Channel, but it has the advantage that you don't need to recompile to make a new Channel and your game designers can make their own channels without additional code.
I watched your event bus video. in that video, you create an event bus for every IEvent type. it is somewhat similar to event channels, what's the main difference between them?
The main difference is the amount of coupling. An Event Channel requires your components to maintain references to the Scriptable Object acting as the channel. The advantage there is that your game designers can create channels whenever they want. With an Event Bus you need to define the Events in C#, but you can use the Bus without maintaining a reference to it because it is a static class. The Bus has potential to be a lot more powerful as well, which we'll explore in the future.
On this channel, I just work on different mechanics for genres until interest begins to wane. At that point, the project is all yours to continue if you like, or dive into another topic! At some point I will revisit these types of games again as the channel continues to grow and new people subscribe.
Typically an Event Bus exists outside of Unity's lifecycle, such as this one, so it's not affected by Awake, Start and so on. th-cam.com/video/4_DTAnigmaQ/w-d-xo.html
Hey everyone! Stick around until the end of the video because I've stumbled upon some great (and FREE) 3D Platformer models that I can't wait to share with you that will help you develop your own 3D Platformer. Details in the video and link in the description.
Man you are very underrated, many tutorials show basic or beginner friendly code, but your tutorial shows more systems, or design in game developing which i have never ever heard, i hope your channel will grow bigger and thank you for all the tutorials
I appreciate that! Thank you!
@@junaidywijaya I will certainly keep that in mind. I'm sure one day I will do something like that.
I was just rewatching and thought I'd let you know in case you didn't: Start can act as an IEnumerator, so instead of calling a function that starts a coroutine, you can just have Start wait one frame before doing anything. Obviously I would only use that if the class isn't very big and only has one or a few responsibilities, but I've found it useful a few times!
Yes, thanks! That's a good tip not many people know!
The additive scene loading would be a very interesting topic. Specifically how to manage different levels and systems in that setup.
Yes, that one is coming up soon!
Id love to see a video about UI like main menu etc. Save and load system also sounds like a nice thing to add.
Bro, this is pure gold. Thank you so much for this vid!
No problem!
Interesting, will have to have a read about this. 90 seconds in seems like decentralized C# events
Loved this series of videos so much. Really taught me a lot about how to properly organize logic across my project and just so much more. Can't wait to dive into this channel even further now!
Great to hear!
Still remember when I first learned about Scriptable Architecture, got so hyped that I wanted to get everything working as a Scriptable Object, until I noticed that I had more resources in the project than everything else... The drag and drop hell was also something that kept me away from this architecture... BUT, for quick prototyping, event channels, scriptable variables, runtime sets and some others are perfect to get things up and running fast!
I like Scriptable Architecture too, but I know what you mean - it can quickly get unmanageable!
A little heads up about using ScriptableObjects as "middlemen" to events if you intend to use the Addressables package:
Depending on the addressables setup multiple instances of the SO might be created causing the events to be invoked in different objects wich makes it unreliable. The worst of this bummer is that this behaviour is only noticeable on builds. In the editor it works as expected.
Good to know, thanks for the heads up.
Solid and usable information as always, thank you!
Awesome content! I'm rewatching your Event Series for the 4th time! Just curious-could Event Channels cause scalability issues in larger projects with many channels? For example, designers might place channels incorrectly, or forget them entirely, as well as create new channels all over the place. When is it better to use an Event Channel over an Event Bus, or should they be used together?
Great question. It's my experience that users (in this case the designers) will always find a way to abuse the tools given to them or circumvent the limitations you place on them. So, while it's great to give them lots of flexibility, you should also keep an eye on it. Me personally, I would try to do as much in code as possible with the Event Bus, but you can definitely use them together.
I have a similar setup though I always just thought of them as events that anyone could just to listen to, instead of a channel. That's what I get for skipping college and building my career through experience instead :).
Should this be included in your playlist like "game programming patterns"?
I think this is more of a Unity technique than an established programming pattern, but maybe you're right.
I could be wrong here but i belive UnityEvent dont need a safe check? before Invoke do they? 🤔
Nice content btw! I was wondering where did you get the name Event Channels from?
I've seen this pattern has been called "Scriptable Events" withing unity community
You are correct; the UnityEvent system is designed to be null-safe when invoking events. If you invoke a UnityEvent and there are no listeners, nothing happens, and no exception is thrown. I think I forget that sometimes!
As for the term Event Channel, it comes from a broader software engineering context, possibly from the book Patterns of Enterprise Application Architecture by Martin Fowler, which is sitting on my desk.
@@git-amend I see, I am going to check the book haven't read it yet
Once again great content man! thanks for the videos!
So i think i understand. Because we're using a scriptable object, it handles the registration and deregistration as a single instance... so this is essentially a decentralized event system, more or less. It's adhoc, not centrally managed.
Am I understanding this?
Clean as always, tysm
Thank you!
Seems useful. Is there a specific advantage or reason why the EventChannels are scriptable objects, instead of just pure C# classes? From my understanding, the only real benefit of the ScriptableObject thing is Unity Inspector niceness (so, good if you have non-coders on your team).
Great question. Yes, the niceness factor is one good reason for using ScriptableObjects, but the primary reason I like this system is that ScriptableObjects exist independently of scenes, as they are assets rather than GameObjects. This allows them to be referenced and accessed across different scenes without issues. They won't be destroyed or invalidated when changing scenes, making them a good choice for managing data or functionality that needs to be shared or persistent across multiple scenes. You could do this with pure C# classes as well, of course, and I recently saw a pure C# EventBus implementation featured on GameDevDigest - it's worth having a look:
github.com/pointcache/BasicEventBus
Awesome video as always. I'm having a problem with performance on the first time calling the unity event. The time goes up to 250 milliseconds, but only the first time, the next times the time is of 2 milliseconds at most. Do you have an idea of what could be causing this or how to solve it? Thanks in advance :)
Not sure about that one, you may need to use Unity's Profiler to analyze the performance of your first event call.
@@git-amend Thanks for the quick answer. I was looking in the profiler, but I couldn't really figure out the problem. I will do more testing in other projects to see if I can narrow the issue. Thanks a lot, really appreciate your help (and your videos, of course)! :D
Just discovered your channel, and I’m soaking in a whole bunch of info atm.
I got a noob question, near the beginning of the video, it looks like in your hierarchy you have a sandbox scene and a gameplay scene.
Is there a reason why you do it this way? Instead of maybe having another canvas on top of the other objects to use as a UI? I’m very new, sorry for the dumb question.
In this video there are two scenes to demonstrate cross-scene communication. Normally you cannot send events to game objects in different scenes in Unity.
Hey! I’m really new to all of this and I just finished making a version of your file but I wanted a first person point of view on the character, how should i go about implementing that into the scripts/project without messing anything up? I figured I could look up a tutorial on how to make one in a statemachine but how would I put it into the one I have already?
Hello sir,
Is there any benefits using Event Bus against Event Channels ?
The Event Bus is a completely decoupled system, so none of the users of the Bus need to have a direct reference to the Event Bus to use it, and it can handle any type of Event. On the other hand all the users of an Event Channel need to keep a reference to the Channel, but it has the advantage that you don't need to recompile to make a new Channel and your game designers can make their own channels without additional code.
Hi git amend can I try and make a tutorial on how to make vertical scrolling level maps?
I Would appreciate that
It has lots of potential
Of course!
@@git-amend thanks ;)
I Think if there is y value then if you change it to x value it could be horizontal
I watched your event bus video. in that video, you create an event bus for every IEvent type. it is somewhat similar to event channels, what's the main difference between them?
The main difference is the amount of coupling. An Event Channel requires your components to maintain references to the Scriptable Object acting as the channel. The advantage there is that your game designers can create channels whenever they want. With an Event Bus you need to define the Events in C#, but you can use the Bus without maintaining a reference to it because it is a static class. The Bus has potential to be a lot more powerful as well, which we'll explore in the future.
Hey thx for awesome game architecture but can you do again all game pattern and system in unreal engine and c++
Haha sure, just as soon as the channel is big enough that I can quit my day job 🤪
@@git-amend This channel needs an urgent subscriber increase! Because I have C++ codes that I need to fix in Unreal Engine :D
Will this series be continued?
On this channel, I just work on different mechanics for genres until interest begins to wane. At that point, the project is all yours to continue if you like, or dive into another topic! At some point I will revisit these types of games again as the channel continues to grow and new people subscribe.
18:04 How would an event bus solve this issue? I don't get it. Great video btw.
Typically an Event Bus exists outside of Unity's lifecycle, such as this one, so it's not affected by Awake, Start and so on. th-cam.com/video/4_DTAnigmaQ/w-d-xo.html