Why is Javascript recommended over C#?

Is javascript more integrated into unity? Does it do things in unity that C# cant? I love coding in C# and Microsoft Visual Studio. Are there any pitfalls or bugs to using this approach in unity?

What advantages does Javascript have in Unity?

Thanks!

There's several posts about that, such as How Should I Decide C#/Boo/Javascript. Personally, the only real advantage I see is that most of the tutorials are in Javascript. However, I wrote an Answer that covers most of the differences in syntax (C# Syntax Differences), so that shouldn't be a deciding factor.

As for integration, really C# is better integrated, with Visual C# Express having full Intellisense for Unity objects. So far there is no similar Javascript editor.

So if you prefer C#, I think you're in luck. :) Welcome to the club.

Javascript in Unity is specifically customized for the environment and more pleasant to work with for most Unity programming. For example, Javascript:

var moveTime = 10.0;

function Awake () {
    Move(moveTime);
}

function Move (timer : float) {
    var endTime = Time.time + timer;
    while (Time.time < endTime) {
        transform.position.x += Time.deltaTime;
        yield;
    }
}

In C# you have to do this:

using UnityEngine;
using System.Collections;

public class MoveScript : MonoBehaviour {
    public float moveTime = 10.0f;

    void Awake () {
        StartCoroutine(Move(moveTime));
    }

    IEnumerator Move (float timer) {
        float endTime = Time.time + timer;
        while (Time.time < endTime) {
            Vector3 pos = transform.position;
            pos.x += Time.deltaTime;
            transform.position = pos;
            yield return null;
        }
    }
}

Over the course of a project, this sort of thing becomes quite irritating to deal with. However, C# does have some functionality that JS lacks, and if you're happy with it to begin with, you might as well stick with it.

I just them both.

For most small scripts, I prefer javascript because I don't need to type in the class deceleration, and I can rename the file without having to change the script.

There are more examples of .net system libraries usage that use C# over javascript, so I use C# for accessing the .net libraries.

However, as stated below you can do it with most everything JavaScript. If you prefer C# there is no drawback to using it %100.

C# with the backing of the Mono framework, and being the main language in the Microsoft.NET environment makes it a huge plus if you wish to extend your coding to beyond Unity. Such as writing software apps or websites in ASP.NET.

For me the absolute single biggest reason though to use C# over Javascript in Unity is the intellisense in Visual Studio. Productivity wise I get so much more done in C# because of it.

At the end of the day if you want to be a complete Unity developer, you should be able to read and code proficiently in both languages.