Using Scriptable Objects for Events in Unity | Scene Independent Event System

preview_player
Показать описание


--- VIDEO RESOURCES ---

❤️ Find me elsewhere on the internet:

📜 If you like this video and want to develop your skills I can highly recommend the following courses I have taken*:

Unreal Engine Blueprint Game Developer:

Unreal Engine C++ Developer:

Beginning C++ Programming:

The Ultimate Guide to Game Development With Unity:

🖱️ This is the gear that I use to create*

*These are affiliate links which means I receive a small commission if you decide to buy something - the price will be no different to you though! I would massively appreciate any support :) *

Chapters:
00:00 - Coming Up
00:15 - Singletons and why we won't use them
01:15 - What are Scriptable Objects
02:14 - Demonstration
03:35 - Showing the code
07:30 - Creating a new channel from scratch
14:05 - Showing the broadcaster in a seperate scene
15:10 - Video outro
Рекомендации по теме
Комментарии
Автор

⏰ 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!

DanPos
Автор

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!

VoonNBuddies
Автор

Great tutorial, completely understood the concept after watching!

dotomomo
Автор

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.

mcinerc
Автор

Exactly what I needed to know, all the respect man to you

alextreme
Автор

This is a really great tutorial, thanks for the great example and explanation 👏👏

juliavalerialopez
Автор

Excellent tutorial and demonstration of ScriptableObjects and Unity events!

ernestj
Автор

Great video! thank you so much.

It has helped me a lot!

erosallica
Автор

please fix your mic input. The repeating high frequency audio really hurts while listening.

takingpictures
Автор

Is it just me, or is there a high pitched beep in the background?

martinmica
Автор

Hi Dan, do you know how to use coroutine within the listener function? thanks

klauspeters
Автор

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.

FrogKin
Автор

Really cool video. Does a system like this work for more Complicated systems such as camera shaking or ui management?

Justin-qrmh
Автор

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.

FyresGames
Автор

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.

TheKrckeR
Автор

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).

iDerp