Scripts let you customize and extend the capabilities of your application with C# code.
Create scripts that derive from Unity’s built-in MonoBehaviour class to control the behavior of GameObjects with componentsA functional part of a GameObject. A GameObject can contain any number of components. Unity has many built-in components, and you can create your own by writing scripts that inherit from MonoBehaviour. More info
See in Glossary. Create scripts that derive from ScriptableObject to store large amounts of data efficiently in your application. Alternatively, you can start with an empty C# script to develop your own non-Unity classes.
Unlike most other assets, you usually create scripts directly within the Unity Editor.
To create a script:
Assets folder (Project tab) More infoUnity creates the script asset and compiles it. To edit the script, double-click it in the Project window to open it in your external script editor. To use a MonoBehaviour script as a component, attach it to a GameObject.