This is the documentation for the legacy script system. The legacy script system is still available for new and existing projects. When you create a new project you are given the choice over which script system you wish to use.
In general, we recommend you use the new script system. However, there are some use cases where the legacy script system is still required. Use the legacy script system if:
- you require the "local workflow". e.g. Editing scripts in text editor on your machine
- you require integration with a version control system like Git or Mercurial
- you have an existing project that you do not wish to recreate.
Below is the documentation for the legacy script system
You can think of your application as divided into two separate code bases. The Engine, which is provided by PlayCanvas, and implements general purpose functionality such as graphics rendering, input handling, audio, and the interface to the PlayCanvas tools; and Scripts which will often be specific to your application or re-usable chunks that provide useful behaviours.
<script> tag. If you're rewriting parts of the engine you probably don't need this introduction to scripting.
Note please make sure your scripts are not cached by the browser - otherwise you will not see the results of changes to your scripts. See here.
First off, lets define a few pieces of terminology.
- Script Component The script Component is defined in the PlayCanvas engine and gives a game Entity the functionality that loads a script and creates a script object.
- Script Instance A script instance is script object which has been instantiated at runtime, using the