We will also be using the following specific Unity engine API features:
- Static
- UnityEvents
- UnityActions
If you are unfamiliar with these concepts, please review Chapter 3, A Short Primer to Programming in Unity.
The code files for this chapter can be found on GitHub at https://github.com/PacktPublishing/Game-Development-Patterns-with-Unity-2021-Second-Edition/tree/main/Assets/Chapters/Chapter06.
Check out the following video to see the code in action:
https://bit.ly/2U7wrCM.
If you find yourself having problems understanding the mechanism behind delegates, keep in mind that they are similar to function pointers in C/C++. In simple terms, a delegate points to a method. And delegates are often used to implement event handlers and callbacks. An action is a type of delegate that you can use with a method that has a void return type.