Unity Property Attributes

When a variable is set to public, as opposed to private, in C#, with Unity it is exposed to the Inspector, which allows real-time changes. In most cases, this is great; it is exactly what we want to quickly create feedback.

There are cases though, for instance, using Singletons or creating static classes, in which we need variables that are to be set to public, but we do not want them to be changed in the editor. These are cases where other classes need to change the variables. Let's have a look at our Application Manager:

If you look at our Application Manager at the moment, it is an absolute mess. As you can see, ...

Get HoloLens Beginner’s Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.