Hi, I’m a game developer and software engineer working in Los Angeles. You’ve stumbled upon my blog, where I write about software development topics, or whatever else. Also check out my portfolio to see some of my work.

## Should You Use Monobehaviour?

When you create a new C# class in Unity, it automatically inherits from the Monobehaviour class, which is Unity’s base class for components. In Unity, you tend to create a lot of components, but it’s important to keep in mind that you don’t have to.

When I first started using Unity, I thought everything should be a Monobehaviour subclass. Some of my students have also had this misconception. Sometimes, it’s better to create a “plain old” C# class. But to make that decision, you need to understand what you get with a Monobehavior that you don’t get elsewhere.

## Encapsulating 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.