It compiles and bundles all scripts using Browserify and gulp.js.
It uses playcanvas-sync to automatically synchronize with your project, but it also uses dotenv, so there is no need to copy any files anywhere, just copy your API key and project_id to .env.
Not only that, but it also uses decorators to simplify creating scripts. This solution was inspired by: Ciberusps - playcanvas-typescript-example.
I also created some quality of life scripts for automatic branch id checking, downloading builds, and starting local server with said build.
Just follow the steps in readme file.
In my own setup, I also use my own fork of playcanvas-sync that allows to skip branch check, so it works inside CI. I would recommend doing the same.
If you added tween.js to playcanvas project, then typescript has no information about type definitions.
You can install this library through npm: playcanvas-tween, or add your own definition.
Alternatively, you can just add this comment before lines where you use tween:
tween is not declared in pc.Entity. You have to do it yourself.
You can try to add something like this
import { Tween } from "tween.js"
interface TweenedEntity extends pc.Entity {
tween: Tween
}
class YourScriptComponent extends pc.ScriptType {
public entity: TweenedEntity
// PLACE YOUR CODE HERE
}
And run the next command in your repo npm i @tweenjs/tween.js @types/tweenjs (install types and optionally tween.js).
In tools/download.js you have scenes array which by default is empty. You have to add to it ids of scenes that you want to include in the build. First id will be default scene.
You can get the id of current scene from the url of open project. For example: https://playcanvas.com/editor/scene/1272532 - the last part is the id of currently open scene.