Hi friends.
I want to make an editor extension and automatically replace some of sprite frames of sprite components in the scene via searching and finding with names corresponding sprite frames from an atlas in asset db.
I used scene walker script in editor extension and managed to find sprites in asset database with queryAssets:
Editor.assetdb.queryAssets( 'db://assets/**\/*', 'sprite-frame', function ( err, results ) { Editor.log("URL: " + result.url); }
And I have managed to get corresponding sprite in the scene:
let scene = cc.director.getScene(); let node = scene.getChildByName("smsg_logo_512_rgb"); let sprite = node.getComponent(cc.Sprite); sprite.spriteFrame = result; // this doesn't work
But I can’t set spriteframe from the query. How can I do that?
Here is the screenshot:
@slackmoehrle @jare can you help me guys? Thanks.