Click here to Skip to main content
Click here to Skip to main content
Technical Blog

Tagged as

Unity and C# : Learn Scripting

, 7 Apr 2014 CPOL
Rate this:
Please Sign up or sign in to vote.
Scripting is an essential ingredient in all games. Even the simplest game will need scripts to respond to input from the player and arrange for events in the gameplay to happen when they should. -Unity3D Everything in unity3D is a GameObject. We first start building a game by setting the sprites (2D

Scripting is an essential ingredient in all games. Even the simplest game will need scripts to respond to input from the player and arrange for events in the gameplay to happen when they should.

-Unity3D

Everything in unity3D is a GameObject. We first start building a game by setting the sprites (2D) / 3D models in their respective positions.In a 2D game setup,Players and enemies will be in the foreground and other elements which we don’t interact much will be in the background.Once this is done,you have some non-moving static GameObjects.Its just like a photo rather than a video which you enjoy watching.

To make these Gameobjects move, to be more precise move according to your inputs/instructions.Scripting is very much required.

Scripting

 

Unity supports three programming languages natively:

  • C# (pronounced C-sharp), an industry-standard language similar to Java or C++;
  • UnityScript, a language designed specifically for use with Unity and modelled after JavaScript;
  • Boo, a .NET language with similar syntax to Python.

 Which one should I learn and use ?

Huff!! a very tough question to answer.There’s always a missing clarity on this.To be diplomatic i can answer like this

Every Language has its own pros and cons.

But i won’t….I support C# because

  • Its a strongly-typed,type-safe language.
  • Purely based on Object-Oriented programming concepts.
  • Above all, i am comfortable with C# as my background is .NET.

Note : Boo,as of now is completely out of the race.

Whenever i have this question of ,i read this

I would say it depends very much on your past experience. If your background is in C++ or Java, you will likely feel most at home in C# – however if you’re experienced with dynamically typed languages such as JavaScript / Basic or PHP, chances are you will prefer JavaScript.

If you have no previous experience with programming – JavaScript might be an easier introduction – given that you do not need to worry about types and casting.

Do note that writing JavaScript in Unity is not the same as writing it for web browsers (which is why it is popularly nicknamed UnityScript in the community). You should check out the tutorials to familiarise yourself with it if this is the route you’re going to take.

If you are planning to work with other programmers on a Unity project, I very much recommend that you decide from the beginning to work in the same language. While it is completely possible to combine scripts written in multiple languages into one project, you will very likely at some point run into issues due to the nature of the task of compiling and linking multiple languages.

Finally do notice that all documentation and tutorials for Unity are currently written in JavaScript and of the three available languages for Unity, only C# examples are given in the .NET documentation (since you are working with mono, you have full access to the mono port of the .NET library).

Learning scripting is not a one day task.Scripting is a skill that takes some time and effort to learn.

Here are some links to start with

Video Tutorials

Courtesy : Unity3D docs and Forums


Filed under: C#, unity Tagged: C# scripting unity3d, learn, learn unity scripting, learn unity2d, programming languages, Scripting, Unity and C# : Learn Scripting, Unity project

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Vidyasagar MSC
Software Developer (Senior)
India India
Microsoft MVP (Games for Windows)
Developer | Blogger | Mentor | Gamer
Coder by profession | Gamer By Heart
Technical Blog : http://onestopdotnet.wordpress.com/
About me: http://about.me/mscvidyasagar
Follow on   Twitter

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150129.1 | Last Updated 8 Apr 2014
Article Copyright 2014 by Vidyasagar MSC
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid