No. You don’t need the CDN either. The API is exposed on the Editor page.
I use Volient Monkey. I generally do small testing directly in the browser devtools console. To make things easier, I connect Visual Code to Violent (instructions on Violent Monkey site). You can create your own browser extension too.
No. Anything that is editor.call is ‘private’ API and subject to change. Some parts I’ve found are needed to get references to certain elements though.
Yes there is. On the Editor page, open up devtools and find the file editor.js. you can see the whole of the Editor code there.
How are you using the API? Directly in the console? If so, not all operations return a value hence undefined.
For example, assigning a value to a variable doesn’t return a value for the operation.
As a quick example: Select an entity in the hierarchy and type the following on the console:
That should print out the object selected in the console
So… I would need to create an extension even for testing? Or at least a function.
When I tried pasting in a function filled with code I got several line/indent syntax errors. Trying to find the correct way to code currently now.
Getting/setting entities properties works fine for me. But only if they’re selected. If I try to get an existing asset for example I always get either said undefined/null or even a unrelated list.
Earlier sort of yes. But currently no. (still working on building the basics of code before I write my extension)
Example of what I’m trying to do (probably doing it wrong):
Doesn’t matter really. The first one is modern JS and is considered ‘better’ as there’s less risk of getting something wrong. Eg forgetting to use the i value. Using the wrong index if its a nested set of loops. If the code in the loop was longer, you wouldn’t have to temp assign the asset you need.
TLDR whatever is understandable to you and gives you less code to maintain.