Custom editor js command

Hello, I’m trying to create some usefull snippets of js I can paste into browser console from the online editor for process some data into my assets.

so far this work for renaming items in hierarchy :

var asset=editor.call('selector:items')[0];
asset.set('name','TEST');

but if I select an asset instead (i.e a material) and type this :

var asset=editor.call('selector:items')[0];
asset.set('name','TEST');

i have this output:

true
editor.js:33546 Error: invalid:path(1)
    at Connection.handleMessage (editor.js:13101)
    at socket.onmessage (editor.js:13054)
    at WebSocket.connection.socket.onmessage (editor.js:14776)

anything I’m missing?
glad to see any docs around for that kind of coding too, I just found this so far : Scripting the PlayCanvas Editor
thank you for any help :slight_smile:

asset._data.data._data.WHATIWANTTOEDIT=WHATIWANT

did the job :slight_smile:

EDIT : actually no, it changes the texture map but doesn’t save the change if I reload the editor :frowning:

EDIT : this seems to work for change diffuse color :

var assets=editor.call('selector:items');
for (i = 0; i < assets.length; i++) {
	var thisdata=assets[i].get('data');
	thisdata.diffuse=[0,0,0];
	assets[i].set('data',thisdata);
}

but I’m still stuck with ‘name’