Where to begin

When we write a standard C# program, we would use the Main() function as our starting point. In Unity, we use the Start() and Update() functions as our main sources of flow control; these functions are part of the MonoBehaviour class.

MonoBehaviour is the base class of all Unity scripting. All classes derived from MonoBehaviour are required to be attached to a GameObject to run. MonoBehaviour also has a set of events or functions each script responds to.

We have touched on some of these events in previous chapters:

  • Start: This is called on the frame when a script is enabled, often used for setup.
  • Update: This is a method that is called every frame.
  • OnMouseDown: This is a method that is called when the user clicks the mouse ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.