Closed yarpskendaya closed 1 year ago
This repo is meant to be for use with the Editor which doesn't use modules. So all class definitions are in global scope, there's no need to import them. You can see ES6 classes used in this Editor project: https://playcanvas.com/project/950571/overview/fps-pit
If you want an example of using the Engine without the Editor and with modules, the Model Viewer repo could help here; https://github.com/playcanvas/model-viewer
I got it working in playcanvas, like you said without modules, thanks for the clarification. Now I'm running into issues where the unit tests cannot find these global class definitions, but that's up to me to figure out.
This repo has been a great help, but I'm really struggling to get a good class hierarchy going where I can unit test my own class definitions, that I then use within pc.ScriptTypes. The file that you define a script in, like:
class Foo extends pc.ScriptType
requires to be a file that is not a module, because otherwise it complains:'pc' refers to a UMD global, but the current file is a module. Consider adding an import instead.
This makes it impossible to import modules into this file, which stumps me, because I don't know how to use classes in other files without the import statement.
An example within this repo would be of great use! Any other pointers appreciated!