Reflection Series – Part 3: Attributes are Magic

Attributes in C# are those things wrapped in "[]" that are sprinkled on classes, properties, or variables. In Unity, I usually use [SerializeField] so that a variable becomes editable in the editor but still remains private or protected in code if I wanted to. There are other attributes, too, like Range, ExecuteInEditMode, HideInInspector, DisallowMultipleComponent, etc. … Continue reading Reflection Series – Part 3: Attributes are Magic

Reflection Series – Part 2: Harnessing Properties

One of my favorite features in reflection is the ability to know about the properties of a certain instance at runtime. This has helped a lot in making tools to aid game development. Basics The following code is the simplest way to iterate through the properties of an instance: PropertyInfo contains the information about a … Continue reading Reflection Series – Part 2: Harnessing Properties

Reflection Series – Part 1: From Class Name to Instance

I'm starting a series on how I've used reflection for my projects. I saw that I've actually made a lot of stuff out of it and I just can't put them all in one long post. I'll start with a brief introduction to what reflection is and discuss a simple usage that has huge potential. … Continue reading Reflection Series – Part 1: From Class Name to Instance