Game Development Reference
In-Depth Information
It is recommended that you create a new folder called scripts inside the root folder of the project
Assets to save our scripts in. After creating the folder, we are going to create our first script
CameraMover into it.
Unity supports three different programming languages, but I will stick to C# in this topic.
However, if you are familiar with Javascript , you may use it instead of C# by changing the
syntax of the scripts listed in the topic. It is also advisable to use MonoDevelop development
environment included with Unity insteadof MicrosoftVisualStudio .Listing1showsthedefault
templateforall C# scriptscreatedinUnity.
Listing 1: Default script template in Unity
Unity helps us by adding the most common functions, Start() and Update(). The first one is
important to initialize the script (i.e. to set the default values of the variables), and is called
once at the beginning of the script life cycle. The second function Update() is called once
per frame, in order to perform the required changes on the properties of the object over
time.
Search WWH ::




Custom Search