Friday, September 16, 2022
HomeGame DevelopmentLearn how to Dynamically Load Assets outdoors sources folder in Cocos Creator...

Learn how to Dynamically Load Assets outdoors sources folder in Cocos Creator 3.5? – Cocos Creator


Is it doable to dynamically load/name asset with out utilizing sources in Cocos Creator 3.5.0 ?

I do know that this can works:

sources.load("test_assets/picture/spriteFrame", SpriteFrame, (err, spriteFrame) => {
this.node.getComponent(Sprite).spriteFrame = spriteFrame;
});

However as a result of legacy folder construction, the previous belongings are situated outdoors the sources folder. And there are tons of it, I wish to keep away from shifting these oldies.

Let’s say the folder construction is one thing like this:

belongings
|- Pictures
 |- Background
  |- bg_mdl.png
  |- bg_rn.png
|- Assets
..
..

So, what i would like is to dynamically assign this bg_mdl.png and bg_rn.png right into a sprite node within the scene.

I’m utilizing Cocos Creator 3.5.0 and Typescript. Is it doable to do it?


RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments