How to Dynamically Load Resources outside resources folder in Cocos Creator 3.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. Is it possible to do it?



https://docs.cocos.com/creator/3.5/manual/en/asset/asset-manager.html?h=bundle.load
you can check it.

1 Like