How can I declare class properties of an object in a single line?

Instead of populating a new class variable by declaring its properties one at a time, is it possible to do it in a single line?

I.e., Rather than…

var myClassInstance : MyClass; = "a name"; = "a place";
myClassInstance.number = 32;

…could I do something like the following instead?

var myClassInstance = new MyClass( "a name", "a place", 32 );

in c# it is

MyClass myClassInstance = new MyClass(){name = "a name", place = "a place", number = 32};

not sure about JS but you could try

I use object initializers for Unity objects and structs, because we can’t make more constructors for them. I rarely use it for my own classes/structs.

Please tell us if this works in UnityScript. I can’t recommend using UnityScript for any reason, but I’m interested.

I didn’t realize you didn’t know about constructors. Learn those first.