Creating and attaching scripts
Creating a new script
To create a new script use the Asset Panel and select New Script
Attaching a script to an Entity
Script Components are attached to Entities in the same way as all other Components using the Add Component button in the Entity inspector.
If you are using the PlayCanvas code repository to store your code, you can edit code in the PlayCanvas code editor, click a script's name below the URL input box.
A script component can load multiple script files, just add multiple scripts to the component. The order in which you add your scripts on a Script Component is the order in which the scripts are going to be initialized and updated. If you want to change the order of a script, click on the Up - Down arrows next to the Script's title. To remove a script click on the X button.
Using Script Priorities
The second way to use a script in your application is to add them to the script priority list. This will load your script up front, before the rest of your application. See the Script Priorities page.