unity

Delegates and Events in Unity

  Objective: The Objective of the tutorial is to understand how to use and implement Delegates and Events in Unity. If you enjoyed my previous tutorial about Singleton, this is second of many tutorials to learn how to use unity to full potential and write efficient code in Unity. Introduction : Delegates and Events is very powerful feature of C# programming language, it helps to write efficient and clean code in unity. Delegate : A Delegate is a reference pointer to a method. It allows us to treat method as a variable and pass method as a variable for a callback. When it get called , it notifies all methods that reference the delegate. The basic idea behind them is exactly the same as a subscription magazine. Anyone can subscribe to the service and they will receive the update at the right time automatically. I know at this time everything seems very…