How to ClickButtonSpawnEntity

How to ClickButtonSpawnEntity,click UI BUtton

Hi @xiaoyao,

Here is a tutorial for adding buttons and executing code on click:

https://developer.playcanvas.com/en/tutorials/ui-elements-buttons/

And here is another that shows how to spawn an entity on demand:

https://developer.playcanvas.com/en/tutorials/place-entity-without-physics

Sorry I can’t understand that, can you try translating it in english?

Thank you very much, sir, but do you need a clone reference object in Chengdu? Is there a directly generated API, which directly obtains its information from the resource area, similar to the spawn actor in UE4

Ah right, yes, you can use templates for that. Having a template asset you can spawn an entity from there.

Check this manual page on how to get started with templates:

https://developer.playcanvas.com/en/user-manual/templates/

1 Like