Delegates are at the core of Unity’s event systems, input, UI, and many popular libraries — but they’re often misunderstood. In this video, we break down what delegates actually are, how Unity builds on them with events and UnityEvents, and why closures can quietly introduce allocations and lifetime issues. We’ll walk through real Unity examples, show how inversion of control improves game architecture, and finish with a practical pattern used by libraries like PrimeTween to avoid closures entirely. If you want clean, flexible, and allocation-aware Unity code, this video is for you.
Want to support me? 😀
Buy me a coffee! https://ko-fi.com/adammyhre
🔔 Subscribe for more Unity Tutorials / @git-amend
Discord: / discord
#unity3d #gamedev #indiedev
▬ Contents of this video ▬▬▬▬▬▬▬▬▬▬
0:00 What Is a Delegate?
3:15 Evolution of Delegates
5:17 Delegates as Inversion of Control
7:24 UnityAction and UnityEvent
9:43 Closures
More Useful Code:
https://github.com/adammyhre?tab=repo...
Unity Utility Library: https://github.com/adammyhre/Unity-Utils
Lock Inspector Hotkey: https://gist.github.com/adammyhre/475...
Other Recommended Tools (Affiliate Links)
Init(args) - https://assetstore.unity.com/packages...
Wingman - https://assetstore.unity.com/packages...
Favorites Window - https://assetstore.unity.com/packages...
Scene Notes - https://assetstore.unity.com/publishe...
Beautify - https://assetstore.unity.com/packages...
Odin - https://assetstore.unity.com/packages...
Odin Validator - https://assetstore.unity.com/packages...
Hot Reload: https://assetstore.unity.com/packages...
Better Hierarchy: https://assetstore.unity.com/packages...
Better Transform: https://assetstore.unity.com/packages...
Better Mesh Filter: https://assetstore.unity.com/packages...
Editor Console Pro: https://assetstore.unity.com/packages...
Any Object Finder: https://assetstore.unity.com/packages...
Kybernetic Tools: https://assetstore.unity.com/publishe...
Sisus Tools: https://assetstore.unity.com/publishe...
Prime Tween - https://assetstore.unity.com/packages...
Rabbit Logger - https://assetstore.unity.com/packages...
Follow me!
https://linktr.ee/gitamend