The script is called when the editor loads

I now call the script when I initialize,But it didn’t work

Can the script be called on the edit page to see the effect. Do not open a new page preview

Hi @Jeggery and welcome,

Are you talking about executing a script in editor, without launching your app?

There is the Editor API that was recently made available that allows you to add scripting support in editor.

Right now it doesn’t handle script execution, you will have to handle that on your own (e.g. in the browser console, or via a custom browser extension).

@yaustar shared an example with instructions on how to approach that:

We also have some formal documentation here :slight_smile: Editor API | Learn PlayCanvas

1 Like

Hi, can’t get how to execute script method in editor like editorInitialize in uranus

I stopped on this

const entities = editor.entities.list().filter(e => e.has("components.script.scripts.resourceView"));
entities.forEach(entity => {
const script = entity.get("components.script.scripts.resourceView");
// script.prototype.rebuild();

Is it possbile with Editor API?

Hi @Ciberus,

The Uranus Editor Scripting repo has been deprecated and it’s now part of this commercial closed sourced solution:

If you are looking to have your scripts initialize in editor and fire a custom method, it may be possible with the editor API (though be prepared you may have to access some editor.js methods directly). But it’s quite advanced to build that on your own.

What are you trying to do?

So, I have script ResourceView that display resources using attributes type("gold" | "gem" | "exp") and isIconRight(bool), depending on attributes visual should change. On initialize I call rebuild method that change view e.g. change icon sprite depending on type attribute, change icon pivot and anchor depending on isIconRight. In realtime all works fine because initilize calls rebuild and view rebuilded, but in editor I have only one scipt “variant”, ofc i can do same steps from “rebuild” method manually, but I dont want to do it every time(


I think you could use the Editor API to automate that, running code in the browser console. You will have to figure out the exact paths to use get/set on the entity items.

To get the path observer your bottom left corner when you manually edit a script attribute:


1 Like