November 7th: Exploring an 80% lower cost hosted Redis alternative - register

Question: Does Unity Use JavaScript?

Answer

No, Unity does not use JavaScript, at least not in the way that might be assumed from the question. Historically, Unity allowed developers to write scripts in a language they called UnityScript, which was similar to JavaScript, but this option was deprecated. Unity uses C# as its primary scripting language.

UnityScript's syntax was indeed akin to JavaScript, but it was not the same language. It was designed to make it easier for developers with web development experience to start making games in Unity. However, Unity decided to focus on supporting one main language, and since C# was more popular and powerful due to its features and the support from Microsoft's .NET Framework, Unity decided to fully embrace it.

To provide a bit of context with an example, here’s how you might have traditionally written a simple script in Unity using C#:

using UnityEngine; public class ExampleScript : MonoBehaviour { void Start() { Debug.Log("This is a C# script in Unity."); } }

UnityScript would have looked somewhat similar but was distinct:

// UnityScript - Deprecated #pragma strict function Start() { Debug.Log("This is a UnityScript script in Unity."); }

As of now, all new Unity projects use C# for scripting. For those who are used to JavaScript and looking to transition to Unity, there are many resources available to learn C# within the context of game development, as the syntaxes are not entirely dissimilar, and the concepts of programming carry over between languages.

Was this content helpful?

White Paper

Free System Design on AWS E-Book

Download this early release of O'Reilly's latest cloud infrastructure e-book: System Design on AWS.

Free System Design on AWS E-Book

Switch & save up to 80% 

Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement. Instantly experience up to a 25X boost in performance and 80% reduction in cost