How to Create and Use Script in Unity


How to Create and Use a Script in Unity:

Assets: Scripts
Scripts: are behavioral components
Whenever we want to add some behavior to game objects we create new script
Ex: CS, JS
CS: C Sharp
JS: Java Script

1. Create a cube
GameObject Menu - 3D Object - Cube

2. Create a script
Assets Menu - Create - C# Script - Name the Script - Enter

3. Attach the script to cube
Select Cube - Component menu - Scripts - Select the script

4. Opening the script
Double click to open the script

5. Type the code in Update method and save:
this.transform.position = this.transform.positon + new Vector3(1f,0f,0f) * Time.deltaTime;

6: Play