Hi, I was wondering if the constructors for classes work the same as they do in C# or C++? e.g. Code (csharp): class Example { function Example( bleh : float ) { memberVar = bleh; } var memverVar : float; } ... Example example( 1.0 ); How does scope work also? Is the default scope public or private? Do I have to use the private/public keyword for each method/member variable or is it like C++?
This is how I write standalone javascript classes in Unity. Code (csharp): class Example extends System.Object { private var privVariable:float; var variable:float; function Example(input:float) { variable = input; privVariable = input; } private function DoSomething() { // Do Stuff ... } } ... var instance:Example = new Example(1.5); Everything defaults to public in unity javascript. You need to specify private if you wish it to be a private method/member.