Delegates? Basically, UnityEvents. But Cooler | Unity C# Basics Part 5 #Shorts
Published: 10 Jun 2022
Full Tutorial: https://youtu.be/1N6k7Hj_JKc
Learn about what delegates are, when to use them, compare their functionality with a UnityEvent, and when you should use a UnityEvent over a delegate! In this video we'll be covering all of that and implementing our first delegate so we can raise an event when our AutoDestroyText is destroyed!
If you've been using Unity for a while, or are just getting started with Unity and decided it's time for you to start learning how to write code - this is the video series you need to start your programming journey!
As always! The full project code is available GitHub: https://github.com/llamacademy/unity-csharp-basics-5
Want the previous episodes?
⚫ Part 1 - https://youtu.be/SXaa61JWLDw
⚫ Part 2 - https://youtu.be/MB6B9nHSrps
⚫ Part 3 - https://youtu.be/TD3yoFg3GVI
⚫ Part 4 - https://youtu.be/JRRlAzBh-6U
⚫ Part 5 - You are here!
📝📝📝YOUR HOMEWORK!📝📝📝
Update your singleton MonoBehaviour to raise events when it spawns an object and when that object is destroyed! For the simplest implementation you can just do a Debug.Log but think about the signature of the event so you can apply it to your game!
Add a comment below with a video showing your code and the end result.
📚 Here are the resources I mentioned and/or brought up during the video 📚
⚫ Delegates: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/delegates/
⚫ Using Delegates: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/delegates/using-delegates
⚫ Unity Events: https://docs.unity3d.com/ScriptReference/Events.UnityEvent.htm
⚫ Singleton: https://en.wikipedia.org/wiki/Singleton_pattern
----
Believe in LlamAcademy's mission and have received value from the videos? Consider becoming a Patreon supporter: https://www.patreon.com/llamacademy
----
Most tutorials come from knowledge gained making https://survival.llama.software Llama Survival - a top-down zombie survival shooter for Android and iOS.
I also have some Unity Assets (affiliate link): https://assetstore.unity.com/publishers/22409?_aid=1101l9QvC