Is Unityscript the same as Javascript?

I am in the process of learning Javascript as I have a good idea for a 2d multiplayer browser game. I would also like to eventually make this game as an iOS app as well, and I am interested in Unityscript as I have heard that it is identical / very similar to javascript. Is this true? And will the transition from javascript to unityscript be easy?

Thanks

Also, is it even possible to make the game online if it is made in unity for IOS using javascript?

No UnityScript and JavaScript are not the same. The library had nothing in common and even syntax wise UnityScript differs from JavaScript in some cases.

1 Like

I just found that Unityscript isn’t supported by unity anymore, and has been replaced by javascript. Is this true?

"UnityScript is not supported by Unity 5. It used to be there in older versions of Unity. It was Unity’s own scripting language (kind of like UnrealScript for Unreal Engine). It was very similar to JavaScript in syntax.

Now Unity Tech has added support for JavaScript itself and C#. Javascript is the programming language of HTML and the Web. Now you can scipt in Unity with it."

Quoted from here: https://www.quora.com/What-is-the-difference-between-JavaScript-and-UnityScript

http://wiki.unity3d.com/index.php/UnityScript_versus_JavaScript

I hate using wiki as a reference but this is spot on with the difference. I use Java script for webdesign alot. But I use C# with Unity mainly useless some one needs help with java script or I get contract and they want that. I knew java script before C# which made it easy to learn. But far as Unity script never heard that its gone or changed… Most people call it javascript because of the extensions js. Plus it is very close to javascript.

When I ask new programmers they always say JAVA, which is not correct. Some have no idea there is a JAVA as well, not in Unity, but Minecraft uses Java and many others use it as well. Anyways never heard of them getting rid of JS, I doubt that will happen because its great for new programmers, and a great way to get them to learn that then move to C#…

When I got my degree for Game Development. They went to Flash , then Unreal Kismet. Then Unity javascript. Then switch to C#… Flash is still used in UI for some company’s… I used Scale form alot when I used UDK 3.

UnityScript and the JavaScript you see in the Unity documentation are the same thing. Its not the same thing as the language you use in web browsers.

UnityScript isn’t actively developed any more. Its still officially supported. But expect that to end some time in the next five to ten years.

Most Unity developers these days use C#.

There are some who bemoan the demise of UnityScript, it did have a few things going for it as a language. But without the commitment to keep developing the language from Unity Technologies its slowly dying.

I agree and disagree… Some schools for Game Design still use it to teach with Unity… If they get rid of JS, aka Unity script all together, that would be bad idea… I have got plenty of people asking me to do contract work, and some still use it… I personally prefer C# but just saying, I think some would be surprised at how many use javascript as a learning tool…
So seeing Unity is easier to get into than alot of engines, I feel that would be a mistake if Unity did this…

The language isn’t dead yet. But its on its way out. Check out this blog post.

http://blogs.unity3d.com/2014/09/03/documentation-unity-scripting-languages-and-you/

Key points

  • Less then 20% of users use UnityScript
  • The documentation team have switched (are switching?) to writing in C# first instead of UnityScript. (Not on the blog, but there were complaints when UNet was released that there were only C# examples)
  • Most of Unity’s standard assets and example projects are all written in C#

None of this is a death sentence for the language by any means. But this and a ton of other anecdotal evidence (Did you hear UnityScript mentioned once at the last Unite) makes it pretty clear that there won’t be support for the language long term.

Of course if the market changes and consumers demand UnityScript it will change. But I can’t see that happening.

That quote is wrong on every single point. UnityScript is still around, and it’s always been called “JavaScript”, which was a serious mistake by Unity when they decided to do that.

The only language they dropped were Boo, as nobody used that. It’s a bit of a pity - the language has some cool features that are either missing from or prohibitively hard to do in C#, while UnityScript is straight up C# with some bad features that you shouldn’t use tacked on to it.

2 Likes

Little off topic, but what features do you mean in boo? It to me just seemed like .net with python like syntax and type annotations.

It seem to have done a good job implementing things like the python style list comprehensions via linq, but most of the cool or unique python things aren’t there like duck typing and multiple inheritance.

i’m afraid you could be right, but I doubt any time soon, but I feel again as I said it would be foolish… 20% may be a little low…by the amount that I get and I know alot of people who refuse to try C# … So I feel that % is a tad low… Maybe 30 % or so… But 20-30% is still a reason to keep it going as it s Unity lost alot of people to Unreal 4… Coding in Unreal with Blue Print is super easy, and in C++ for Unreal I feel is even easier … Alot of the tools included with Unreal is even better were Unity, you have to buy tools like Play Maker, which aton of new users use… Shader Forge is another… Those tools are included in Unreal… Visual scripting is here to stay… no matter if some of us programmers do not use it… I use Shader Forge, even though I can write shaders, I perfer Shader Forge these days…

@passerbycmc

You have macros, which are a mixed blessing. There are also compile-time macros, which allows you to build code based on metadata about your code that can then be used later on. I’m not quite sure about the details.

A very simple example is to create an enum based on the contents of a text-file where you have the names of some characters:

macro define_character_name_enum:
    enumMembers = (s for s in System.IO.File.ReadAllLines("Path_To_Text"))

    enumBody = Boo.Lang.Compiler.Ast.EnumDefinition(Name: "CharacterName")
    for enumName in enumMembers:
        enumBody.Members.Add( EnumMember (Name : enumName))
    yield enumBody

define_character_name_enum

This enum can now be used just like any other enum. The text file is not needed anymore after the compilation is done.

This example isn’t very usefull (and would probably have been a bad idea!), but I can see uses. Say you have an RPG or and RTS or whatever, and need to define unit types. The usual way to allow designers easy access to tweak this stuff is to put the stats of units in XML or a scriptable object or some custom format, and then parse that when you start the game.

Using a macro like this, you might instead parse that data into classes compile time. This would allow you to not include the data files in your builds.

To see an example of this, check out the attached unitypackage, and follow the instructions in. How To make This Work. The short version is that you place a text file on your Desktop named “Names.txt”, and fill it with names. The built-in boo compiler will then create the enum as above, and put those values in a text mesh that’s the only thing in the scene.

This works in Unity 5. Unity didn’t stop supporting Boo, they just stopped having a create script → boo dropdown, and stopped referencing boo existing in the manual.

EDIT: adding the unitypackage
EDITEDIT: still not saying that this is neccessarily a good idea to do. The point was just that there are interesting things you can do in Boo that you can’t do in C#, which is not the case with UnityScript.

2315290–156051–DemoOfBooCapabilities.unitypackage (5.93 KB)

2 Likes

20% is a number from an official Unity blog linked in the post you’re quoting. It’s actually 18.9. So you’re wrong there.

Your point still stands (kinda), but when people reply with links to official stuff, you should maybe read it over insisting on your gut feeling.

Also don’t… end… everything… with… ellipses.

2 Likes

They get their stats from the editor. It’s filled to the brim with analytics, so I think they have a pretty good clue about the actual percentages. YOU knowing a lot of people who don’t like C# doesn’t mean anything. People who prefer something JS-like or C++ tend to flock to other engines anyway, so they won’t affect stats.

Ok thanks. Also is unityscript capable of making multiplayer (online) IOS games?

Both languages compile to the same thing; so yes.

1 Like

did you even read what I said about C++ .I doubt it…