In this tutorial I’ll show you everything you need to know about C# getters & setters in Unity:
- public get / private set
- Backing fields for the inspector
- Analyzing with DotPeek
- Adding logic (clamping, counters, events)
- Advanced use case: self-initializing singletons
If you found this helpful, please consider subscribing!
Current Portfolio / Blogging Site: https://strawberryblog.pages.dev/
#Unity #CSharp #GameDev
Credits This video was made using assets from:
- By Emoji One, myself - File:Emojione 1F42B.svg, CC BY-SA 4.0, https://commons.wikimedia.org/w/index.php?curid=81071410
00:00 Introduction
00:14 What are Fields
01:05 Decompiled Code Example
01:17 Get and Set in Unity
01:45 Custom Logic
02:20 Self-Initializing Singleton
03:00 Outro and favor