Create scripts
Create C# script assets from the Editor to add custom functionality to your application.
Read time 1 minuteLast updated 3 days ago
Scripts let you customize and extend the capabilities of your application with C# code.
Create scripts that derive from Unity's built-in class to control the behavior of GameObjects with components. Create scripts that derive from 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.
MonoBehaviourScriptableObjectUnlike most other assets, you usually create scripts directly within the Unity Editor.
Create a script asset
To create a script:
-
In the Project window, select the folder where you want to create the script.
-
Navigate to the Scripting menu in one of the following ways:
- From the main menu, go to Assets > Create > Scripting.
- In the Project window toolbar, select Create (+) > Scripting.
-
Select the type of script you want to create.
-
Enter a name for the script. For more information about how to name your scripts, refer to Script file names and namespaces.
Unity 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 script as a component, attach it to a GameObject.
MonoBehaviour