O'Reilly logo

Unity 3 Game Development HOTSHOT by Jate Wittayabundit

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Function/method definitions

First of all, terminology—JavaScript uses the term function, while C# calls these methods. They mean the same thing, and most C# coders understand the term function.

JavaScript functions are declared with the keyword function before the function name. C# method declarations just use the return type, and the method name. The return type is often void for common Unity events. JavaScript functions are public by default, and you can specify them as private if required. C# methods are private by default, and you can specify that they should be public if required.

In JavaScript, you can omit the parameter types and the return type from the declaration, but it's also possible to explicitly specify these (which is sometimes necessary ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required