guzu
August 3, 2020, 10:22am
1
Is it possible to create a .js script that works with the editor?
For example, I want an attribute that when it changes, an alert appears, or a string attribute is set.
Hi @guzu ,
That’s possible using an unofficial API available in the editor. Take a look at this thread, it’s quite old but it’s mostly correct:
Do you have any plans for allowing a user to write logic for the PlayCanvas designer?
For example:
Creating procedural levels that add entities directly in the Designer
Extending its functionality e.g. creating a path tool for navigation (camera, entities etc.)
Something like maxscript only you already have javascript and a scripting system in place.
Thanks for the great work!
1 Like
guzu
August 3, 2020, 10:27am
3
Cool!
Edit:
It is going to be a challenge to find my way through it
1 Like
Indeed it can be difficult to start with no docs and the API is prone to changes, but it’s quite powerful. Check this thread for a small how to start guide:
Hi @Patrick_Munster , indeed it is relatively easy to start extending the PlayCanvas editor. Even though there isn’t any documentation right now and as @vaios said the API is prone to change, you can get started now.
The PlayCanvas editor source code is not minified on purpose:
https://playcanvas.com/editor/scene/js/editor.js
You can open up the browser console and type in Javascript that will directly run in the context of the editor. Try this, a simple script that will return a list of all c…
guzu
August 3, 2020, 11:01am
5
Thanks! I’m going through it
1 Like