[SOLVED] Why does PlayCanvas say addComponent is not a function?

When I run the following code, it says that addComponent() doesn’t exist.

var newEntity = pc.Entity();
newEntity.addComponent("model", {
type: 'box',

Can you provide an example project please? The code in isolation looks correct

Physics lab | Editor (playcanvas.com)
WASD to move, space to go up, and you should be able to click to create a new entity, but it doesn’t work

Are you in a branch? Non team users can only see main branch

I guess this should be var newEntity = new pc.Entity();.


Good shout, I completely missed that!

1 Like

thanks so much. This worked!

1 Like