[Solved] Can't find the line of the error while Parse it in Editor

I am trying to adapt the dmeo of
“Generic Sensor - Orientation Phone”

on playcanvas.

However, when I tried to parse the modiefied motion-sensor.js, it kept on showing “Uncaught ReferenceError: screen is not defined”, and I couldn’t find how which line cause the problem. In Editor I can see the code “screen” is recognized as window.screen

Following is my script

Hi @Phoenix,

You can only parse in editor JS scripts that are authored as Playcanvas compatible script files. As specified in the manual:


Parsing them makes them available to be attached to script components and expose their script attributes.

For 3rd party JS library you can’t parse them in editor, that will always throw an error. But you don’t have to, all .js asset files you add to your project will be automatically be added to your runtime project. That way you can access their methods from your Playcanvas scripts.

Just make sure to list them in the top of your script loading order so they load before any other script trying to access them:



got it, thanks for your explanation, that’s simpler than I thought!

1 Like