C# properties are great language features for wrapping up access to variables through internal functions. This helps us validate values assigned to variables, and to detect when variables change. However, C# properties have a performance overhead that makes them expensive compared to direct variable access. For this reason, to optimize script performance, always seek to cache variables. This problem is most notable in Unity when using MonoBehaviour class variables, or static class variables, which provide shortcut access to other components or objects. Consider the following example:
transform.position = new Vector3(0,0,0);
Here, the transform variable provides syntax-quick access to the Transform component ...