The Observer Pattern (Unity & C#) - Delegates, Events, Actions and Funcs
One Wheel Studio
The observer pattern is essentially baked into C# and Unity. It comes in the form of delegates, events, actions, and to some extent funcs. The observer pattern de-couples the source of information from the object receiving the information. This makes unity projects more stable, easier to add mechanics, and far less likely to break.
Blog Post Covering the Observer Pattern: https://onewheelstudio.com/blog/2020/7/24/observer-pattern-c-events
Sebastian Lague's Delegate Series: https://www.youtube.com/watch?v=G5R4C8BLEOc
Become A Channel Member: https://www.youtube.com/channel/UCkr9CPPqT9VWUjkpo3HcACg/join
My video and streaming kit: https://kit.co/onewheelstudio/tutorial-video-production Game Design Reading Suggestions: https://kit.co/onewheelstudio/game-design-reading-list-unity-c-blender-and-more
Discord: http://discord.onewheelstudio.com
Patreon: https://www.patreon.com/onewheelstudio
Twitter: https://twitter.com/OneWheelStudio
Devlog: https://onewheelstudio.com/
Twitch: https://go.twitch.tv/onewheelstudio
TimeCodes 0:00 Why you need the Observer Pattern? 1:20 Problems Solved 1:38 What does the Observer Pattern do? 2:41 What Are Delegates? 4:45 Defining Delegates 6:21 Delegate Parameters & Return Values 7:13 Multicast Delegate 8:01 Static Delegates 8:17 Events 9:08 Actions and Funcs 9:40 Observer Pattern Implementation
#ProgrammingPatterns #ObserverPattern #UnityTutorial #GameDevelopment ... https://www.youtube.com/watch?v=UWMmib1RYFE
53401782 Bytes