Summary

In this chapter, we learned that a method definition ends with a code block between two curly braces, not with a semicolon. The parentheses are part of a method's name. We also learned how to call a method into action, how to use data returned from a method, and that Unity calls some methods automatically, such as the Start() and Update() methods, when the script inherits from the MonoBehaviour class.

You now know the two major building blocks of scripting, variables and methods. From now on, everything else you do will just be making use of variables and methods. Now that you understand these two building blocks, you are ready for the next chapter that deals with making decisions in your code.

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.