Encapsulate Unity Inspector Variables

When writing a Unity component, it’s likely that you’ll want to expose some variables in the Unity Editor’s Inspector, so that either you or a designer can modify those values without having to recompile the script. However, the default method of exposing variables in the inspector can break class encapsulation in an undesirable way. This post explores ways to expose variables in the Inspector without sacrificing your class’s encapsulation.

[Read More]