Property exposing

By default, the Object Inspector displays all public member variables of a class unless it's in Debug mode or a private member is explicitly marked with the SerializeField attribute and in these cases private member variables will be shown too:

Property exposing

Property accessing from the Object Inspector

However, C# properties will never be displayed by default, either in Release or Debug mode. As discussed in Chapter 1, Unity C# Refresher, C# properties act like accessor functions to a variable. They essentially permit validation on each get and set operation because every get and set operation entails an internal function call. However, regardless ...

Get Mastering Unity Scripting 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.