This sounds silly but I don’t know where I can put the name of my new entity that created using script.
I’m using this method to create new script:
var cloned = new pc.Entity();
pc.app.root.addChild(cloned);
This sounds silly but I don’t know where I can put the name of my new entity that created using script.
I’m using this method to create new script:
var cloned = new pc.Entity();
pc.app.root.addChild(cloned);
Check out the PlayCanvas API for pc.Entity.
var cloned = new pc.Entity();
pc.app.root.addChild(cloned);
cloned.name = 'john';
var cloned = new pc.Entity('name');
Thanks a lot. Btw, how can I load an existed script to my new entity with entity.script.create() function?