Script name throws error

Last time I was in Playcanvas writing some boilerplate code, I wrote a scripts called move.

var Move = pc.createScript('move');

Which threw an error. Without any additional changes, I changed it to this

var Move = pc.createScript('new');

parsed the script, and everything ran like butter.

I was wondering if there is any way of knowing what names are acceptable. This already had me in a knot because I was looking at my move script for half an hour trying to figure out what was going wrong, until I found out it was just this name alone.

External libraries include Basis and Ammo.

Do you want first person movement?

Welcome to PlayCanvas!

Hmm, I don’t think it is documented. We should probably add it to the User Manual. For now, you can find the reserved names in the source code here:

1 Like

There should have been an error message saying that the name is reserved and that the script should be changed.

Thanks!

Right, I’m just now figuring out how Playcanvas works, including the console. I’ve got plenty of experience in Unity and done some simple React back in the day but I’m still adjusting. I found the console now (seems obvious in hindsight), so it’s my bad!

Yep, the browser is effectively your debugging tool. You can add breakpoints, execute code in the console etc. Some extra docs here: https://developer.playcanvas.com/en/user-manual/scripting/debugging/

You may also find this megathread helpful too: https://twitter.com/yaustar/status/1359518687066284035

2 Likes