Dynamically load asset without using "resources" Cocos Creator 3.5.0

Viewed 5

Is it possible to dynamically load/call asset without using resources in Cocos Creator 3.5.0 ?

I know that this will works:

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

But due to the legacy folder structure, the old assets are located outside the resources folder. And there are tons of it, I want to avoid moving those oldies. Let's say the folder structure is something like this:

assets
|- Images
 |- Background
  |- bg_mdl.png
  |- bg_rn.png
|- Resources
..
..

So, what i want is to dynamically assign this bg_mdl.png and bg_rn.png into a sprite node in the scene.

I am using Cocos Creator 3.5.0 and Typescript.

0 Answers
Related