⏰ UNITY BLACK FRIDAY SALE ENDS DECEMBER 4th! ⚡ LIGHTNING DEALS SEE 90% OFF SELECT PRODUCTS Take 50% off the best selling assets on the Unity asset store in their Black Friday sale, now on! prf.hn/click/camref:1101lkANY/creativeref:1011l65259
@VoonNBuddies3 жыл бұрын
One small suggestions: Rather than making new classes for each data type, you could create an abstract class that takes in a generic type. This way you can design the general Channel api once without every having to rewrite the functionality. Now, when you want to make, say, a RIgidBody Event Channel, you could simply create a class that derives from the abstract class with RigidBody passed as the generic. Now if you want to change the functionality of your channels, you can do so in the abstract class and any derived classes will inherit that changed behavior. Great video!
@DanPos3 жыл бұрын
That's a good idea! I'll try and refactor it to take this into account :)
@VoonNBuddies3 жыл бұрын
@@DanPos Thanks! I hope that ends up being helpful!
@TheKr0ckeR2 жыл бұрын
@@VoonNBuddies Can you give more detailed information about implementing generic classes in actions for not creating extra classes for extra data typeS? :)
@TheKr0ckeR2 жыл бұрын
I got it. :)
@Legionope9 ай бұрын
Can you please show us roughly how you'd do that? Wouldn't that be something like OnEventRaised?.Invoke(); ?
@mcinerc Жыл бұрын
Awesome video, thanks. I retooled it for my own purposes slightly -- I made a single EventChannel script and created an Arguments class that I can basically add any data I want to. Then every event just uses this one event type, and every channel can support any amount of data. It's probably not the most efficient, but it works for a smaller game where performance isn't super important. The core concept is great and helped me start a pretty huge refactor. Much appreciated.
@juliavalerialopez32122 жыл бұрын
This is a really great tutorial, thanks for the great example and explanation 👏👏
@DanPos2 жыл бұрын
Thank you! Glad you enjoyed it 😊
@dotomomo Жыл бұрын
Great tutorial, completely understood the concept after watching!
@ernestj80002 жыл бұрын
Excellent tutorial and demonstration of ScriptableObjects and Unity events!
@DanPos2 жыл бұрын
Thank you! Glad you liked it :)
@alextreme98 Жыл бұрын
Exactly what I needed to know, all the respect man to you
@takingpictures4536 Жыл бұрын
please fix your mic input. The repeating high frequency audio really hurts while listening.
@FrogKin95 ай бұрын
That‘s a great tutorial. But I‘m left with a question. In my case I have multiple scriptable objects from the same SO-Script (different Items in my case). How could I check which Item invoke the event? Passing the name as a string with the event doesn‘t feel right.
@klauspeters80787 ай бұрын
Hi Dan, do you know how to use coroutine within the listener function? thanks
@looty20-q8q Жыл бұрын
Is it just me, or is there a high pitched beep in the background?
@erosallica Жыл бұрын
Great video! thank you so much. It has helped me a lot!
@GiantsOnTheHorizon2 жыл бұрын
Thanks for a great video!!
@DanPos2 жыл бұрын
Glad you liked it!
@FyresGames Жыл бұрын
My middleman singleton for events is gone thanks to you! I just wonder why you use UnityAction instead of Action? Both work the same but Action can take more args if needed.
@Strategiusz Жыл бұрын
Does it work in a built game too?
@TheKr0ckeR2 жыл бұрын
I really liked the idea! But what happens if we have for example Trader NPC's and all would have their own "OnTradeCompleted" scriptable object? I found myself overkilling, assigning it different SO events for every trader. If i use same SO, when one completed, others are also affected.
@obikwelukyrian68482 жыл бұрын
You could have an OnTradeCompleted event that takes one argument, the Trader NPC class. When each receives the event, it checks if the Trader NPC passed is itself and if so, performs the action
@Justin-qr9mh3 жыл бұрын
Really cool video. Does a system like this work for more Complicated systems such as camera shaking or ui management?
@DanPos3 жыл бұрын
Yes, absolutely! Here's a great video that uses similar concepts to create an Inventory System: kzbin.info/www/bejne/inOYhHaHZpmdgtk
@qasimahamad50753 жыл бұрын
great one
@iDerp693 жыл бұрын
I usually just use a static Events class with a bunch of C# action delegates, then there's no need to wire anything up in the inspector -- plus I can use Visual Studio to find all references to see what's subscribed and what's invoking. I don't like the scriptable object approach that's been evangelized by the likes of Ryan Hipple (I tried it in my own project and it felt like a scalability nightmare).
@AM-vr4qy3 жыл бұрын
I agree. Ryna Hipples systems was a boilerplate nightmare to set up and maintain.
@DanPos3 жыл бұрын
Definitely another great solution, my main goal with this video was to provide an alternative solution to the Singleton way of doing things but you're right a static Events class which also people a good option and achieve similar results to this, without the need for hooking things up in the inspector. That's the great thing about coding - lots of different ways of doing stuff and its whatever works for you and your project. For example, this implementation could work well if you're working with designers who need to hook things up in the inspector and not look at code.
@windwalkerrangerdm Жыл бұрын
Exactly my thoughts. The hard part is not isolating objects from each other, it's to connect them dynamically, without using the editor to hook things up. In a real case scenario you often need to establish listeners and raisers dynamically, and this becomes an issue even when they are not referring to each other directly. A static Event manager system becomes much easier to manage, you just create a SINGLE reference relationship on ONE end of the raiser-listener system (usuall on the listener side). But what I wonder is, which one is better amongst the following two: (1) all your listeners susbcribe to the EventManager system, who in turn subscribe to raiser objects? Or (2) Raisers just use the static Event Manager reference directly and call a function there, which in turn fires an event to which the listeres are subscribed to?