Group Group Group Group Group Group Group Group Group

ScriptableObject Tutorial: Getting Started | raywenderlich.com

In this tutorial you’ll learn how to create and use ScriptableObject in Unity. ScriptableObjects in Unity can increase your workflow, reduce memory usage, and even decouple your code architecture.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/2826197-scriptableobject-tutorial-getting-started

Great Article!

I really like this approach because it has no coupling. But everywhere people recommend not to use UnityEvents. Instead, you should use C# Events/Delegates because it has a better performance. Why did you choose UnityEvents or is there a good way to combine this with the C# native Event/Delegate System?

Glad you enjoyed the tutorial!

I opted to used UnityEvents because this is a Unity tutorial and we’d like to work with Unity not fight against it. That said UnityEvents are definitely not perfect, and have flaws. You can just as easily use C# native events and delegates within a ScriptableObject to get the same decoupled result.

Thank you so much for this tutorial ! i’m so lucky i found this website. but it would be awesome if you make some sections where you explain things( what are listeners, game events and where we use them) then you provide a link to those sections or something, because now for example, you just say " 3- A list of GameEventListeners that will subscribe to your GameEvent " and i have no idea what these two are. but thank you again it helps a lot.

@jayfeesh thank you for such a great platform.

one real quick question, don’t mind if it’s not much logical ,i 'm a newbie.
My question is, when we have sword.cs class which has ability to show data in UI(if we attach the sword.cs script on each sword and pass the reference of each sword’s Scriptable object to this class), then OnMouseDown() function will get the values from each Scriptable object and show in the UI.
isn’t is pretty simple then creating events and event listeners and additional merchant script.?

or is there advantage of using events and merchant script.?
why we did events and event handling stuff.?