C# Programming With Unity – Functions – Awesome Tuts

In programming you will have multiple blocks of code that will represent some logic that your game uses to run.

That block of code can have 10, 100, 300 or more lines of code, and instead writing all those lines of code every single time we need it, we can simply group it in a function and then call the function name and it will execute all those lines.

This way it’s much easier to write and group or code to make it more readable and performance friendly.

As we progress more and start creating games we will see examples of functions very often, but for now I highly encourage you to experiment with the examples we introduced in this post.

Try changing the parameter types and use Debug.Log to print the result in the Console. This is the best way to learn.

Read more here: Source link