The final boss – drag-and-drop system
Back at the 2017 Unite conference, there was a wonderful talk about building out your game architecture using scriptable objects. Unity has come a long way since then, but scriptable objects are still one of the most useful programming tools for encapsulating data in your games. In this last section, we’ll implement the drag-and-drop Observer pattern structure from the Unite conference to give you a starting point for more advanced Unity configurations.
You can find the Unite talk at https://www.youtube.com/watch?v=raQ3iHhE_Kk&t=0s&ab_channel=Unity and a brief write-up by Ryan Hipple at https://unity.com/how-to/architect-game-code-scriptable-objects.
Writing a ScriptableObject event
The strategy behind this implementation is to encapsulate a subject into a ScriptableObject
, which should look familiar because it’s almost exactly what we did at the beginning of the chapter with our traditional...