TEMPLATE: ES6 | Version Control | NPM | PlayCanvas


@whydoidoit I thought this could be of interest to folks who use your ES6 template. I wrote a simple wrapper that makes it possible to write scripts using the ES6 class syntax. I haven’t tested it with your template though. But it works with vanilla PlayCanvas.


can confirm this works with scripts 2.0


omg, thank you @whydoidoit.
Was struggling to get react/es6 infrastructure working with playcanvas. This should get me farther.


@whydoidoit. While I’m able to use ES6 and do DOM manipulation with this setup, it appears like I have no handle on any of playcanvas asset/models. In fact in the below example, it doesn’t even call initialize. Am i missing something ?

const Example = pc.createScript('example');

Example.prototype.initialize = function () {

  console.log('this was reached');

  //this is undefined



You better to use this.app inside a script component, instead of pc.app.


even this.app is undefined :frowning:


First of first, thanks for your contribution! However, I think that I am reluctant to use your code because you give me too much things I don’t need.

Instead, using playcanvas is as simple as using three.js. We just need to replace the animation programme by using the playercanvas’s rendering loop and coding geometries using playcanvas’s scene graph management toolkits.

And I think integrating compiled codes with playcanvas is a choice but not necessary the best choice. The codes from playcanvas are just responding for canvas webgl rendering not dom rendering. We can use other tools to develop editor components which are responsible for data dom bidirectional binding.

Editor should be shipped with frontend codes.