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

The new keyword

In JavaScript, you can create a new instance of an object or struct without using the new keyword. In C#, using new is mandatory.

JavaScript:

var myPosition = Vector3(0,0,0);
var myInstance = MyClass();
//We can also use new keyword in JavaScript
var myInstance = new MyClass();

C#:

Vector3 myPosition = new Vector3(0,0,0);
MyClass myInstance = new MyClass(); 

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