Delegates in C# for Unity Coding Beginners | Unity C# Basics Part 5
Published: 07 Jun 2022
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
Full Series Playlist Here: https://www.youtube.com/watch?v=SXaa61JWLDw&list=PLllNmP7eq6TTjwoyfRYAAFOH1sMHVgI1r
⚫ Part 1 - Writing your first script - https://youtu.be/SXaa61JWLDw
⚫ Part 2 - Loops and Arrays - https://youtu.be/MB6B9nHSrps
⚫ Part 3 - Unity Component Lifecycle - https://youtu.be/TD3yoFg3GVI
⚫ Part 4 - Static vs Instances - https://youtu.be/JRRlAzBh-6U
⚫ Part 5 - Delegates - https://youtu.be/1N6k7Hj_JKc
⚫ Part 6 - Inheritance & Interfaces - https://youtu.be/siRvSZzrhRU
⚫ Part 7 - Compositional Relationships - https://youtu.be/khIweJfnyW4
📝📝📝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
💸 Ongoing sales 💸
⚫ See all active asset sales on the Asset Store: https://assetstore.unity.com/?on_sale=true&orderBy=0&rows=96&clickref=1100lwtudvMJ&utm_source=partnerize&utm_medium=affiliate&utm_campaign=unity_affiliate&aid=1101l9QvC
⚫ Save 25% off your first Asset Store Order: https://prf.hn/click/camref:1101l9QvC/creativeref:1011l78340
⚫ Save up to 50% on NEW Assets: https://assetstore.unity.com/?new_sale=true&orderBy=1&aid=1101l9QvC
❤ Believe in LlamAcademy's mission and have received value from the videos? Become a Patreon Supporter or YouTube Member:
⚫ Patreon: https://www.patreon.com/llamacademy
⚫ YouTube Member: https://www.youtube.com/channel/UCnWm6pMD38R1E2vCAByGb6w/join or click the Join button on any video
----
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
Some links may be affiliate links, which at no additional cost to you, gives me a small portion of the purchase.
#unitytutorial #tutorialtuesday #gamedev #tutorial #unity #llamacademy #gamedevelopment #learntocode