Using Unity's Update and Start methods

Every time you create a script in Unity, these two skeleton methods are included. That's because they are rather important. These are the most commonly used MonoBehaviour methods, see the next screenshot for others. I like to call these Unity's magic methods because you don't call these methods, Unity does. It's usually important that at least one MonoBehaviour method is included in a Unity script to cause the script to execute. I say usually because other methods in the script may be called from another script or class.

How do I know these two methods are called by Unity and that they are MonoBehaviour methods? Here, the Unity Scripting Reference is your friend.

Here's just a portion of the methods Unity can ...

Get Learning C# by Developing Games with Unity 3D 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.