ES6 standards in UnityScript?

I’m just curious. Are we likely to see use of the arrow function being pushed for javascript in unity once ES6 walks on to the scene?

For the people who say “Why don’t you learn C#?”. I never said I don’t use C# :stuck_out_tongue:

This is not a question about which language is better. There are plenty of reasons to work in javascript, for example, perhaps you are working for a company that creates web utilities, and Unity is only a small part of the pipeline for a broader project. You would need some pretty good justification for why 4% of your project should be in a different language!

See the following function that many of us are used to in UnityScript:

function SomeFunction () {
  /*code*/
}

While I prefer the above, those who came to unity from a web developer background could be used to this way instead:

var SomeFunction = function () {
  /*code*/
};

Those same people are probably looking forward to the changes coming in ES6 where the above is replaced by:

var SomeFunction = param => {
  /*code*/
};

//or

var SomeFunction = (param1, param2) => {
  /*code*/
};

or simplified to anonymous functions:

//parentheses not needed for single parameters
//curly braces and semicolon not needed
x => x + 1
(x,y) => x + y

What are people’s expectations? Will unity be making changes to fit ES6 standards or will we remain old-school with our utilisation of JS in Unity?

Unityscript is a custom language, only superficially similar to Javascript in a few ways. It won’t be getting any changes like that, particularly since it hasn’t had any development at all in years (unfortunately).

–Eric

3 Likes

UnityScript probably won’t be updated. Ever.

This change to the standard will simply add to the confusion of competent JavaScript developers trying to switch to UnityScript.

Best to get used to C#. There is a decent chance we will get an update to the latest version within a year or two.

Yeah that’s all well and good. I updated original post though with better clarification on the topic of JS vs C# regarding this thread.

As someone who works in the web world with Unity playing a small role in that, I look forward to some potential updates to unityScript. Though, like you, I am doubtful, like Eric5h5 said, it hasn’t been updated in years. But it seems strange to me. Javascript in unity, or UnityScript is hardly javascript at all, but for javascripters to come in to unity, they will have a lot of assumptions that simply won’t work. I learned UnityScript and C# long before I learned native JS, but I can see why experienced JS developers get really frustrated when coming in to Unity.

It’s fair enough to say they should just get used to C#, I agree. But sometimes you are working on a project that is not entirely built in Unity, and it doesnt make sense to have a small part of a project in a completely different language, for company standards and conventions.

Also, Unityscript already has had stuff like classes, inheritance, getters/setters etc. since forever.

–Eric

1 Like

That’s true, in web design I’ve only recently come into contact with TypeScript and really feel like UnityScript does it better… I suppose I see your point that UnityScript, despite not really being Javascript, is not necessarily “behind” Javascript.

UnityScript is a different language to JavaScript. UnityScript has more in common with C# then it does with JavaScript. You’ve got the 4% in a different language anyway.

1 Like

The big mistake here was naming the language javascript.

3 Likes

Seems like it xD

good point!

I wish Unity would take a clearer stand. Either get rid of UnityScript, or support it and continue to update it. I’d prefer the last, but I understand that I am in the minority.

Edit: Oops, didn’t look at the date. But, still.

1 Like

We can’t drop it right now because a lot of projects have taken a dependency on it. But yes, UnityScript has no real future.

3 Likes

“Know your Roots!”

While we are all aware JavaScript is pretty old, there’s still the Open Source people who have yet to taste the Power of Unity. Legacy Code was written on the same pattern for a reason, this Ancient Beast can be tamed.

No seriously I saw huge potential with ES6 when talking about code standards. Being able to write complex tasks in a few lines of code is a big time saver, especially for the mobile market.

Except it isn’t real JavaScript. It’s a bastardization of JavaScript. Regardless of who you are you’re basically learning a new language when you pick up UnityScript. If it were real JavaScript there might have been reason to leave it in but UnityScript is a complete waste of time.

Thankfully they’re finally removing it.

https://blogs.unity3d.com/2017/08/11/unityscripts-long-ride-off-into-the-sunset/

3 Likes

What Ryiah said.