Home Game Development How to make use of executeInEditMode and assetManager collectively ? (3.6) – Cocos Creator

How to make use of executeInEditMode and assetManager collectively ? (3.6) – Cocos Creator

0
How to make use of executeInEditMode and assetManager collectively ? (3.6) – Cocos Creator

[ad_1]

Hello,

I’ve some code that entry belongings bundle by way of the assetManager and works nice at runtime.
I’d need this code to additionally run in edit mode, however the loading fails in that case.

How do you entry belongings programmatically whereas in edit mode ?
I’m in 3.6.

Thanks prematurely.

Any concept ? I don’t discover something in docs or api.

you should use assetManager.loadAny, here’s a demo:
57210.zip (2.4 MB)

1 Like

loadAny works in editmode to load one file however I have to load a whole bundle not understanding prematurely all the things it accommodates.
loadAny doesn’t appear to have the ability to load a bundle from what I’m attempting.

I appeared on the implemetation of the loadBundle technique within the engine and it does use loadAny.
If you name
assetManager.loadAny({url : "bundleName", preset: "bundle", ext: "bundle", __isNative__: "true"}, (error, knowledge) => { if (error != null) { console.error(error); } console.log(knowledge); })
Like it’s achieved within the loadBundle implementation, it does provide you with an object at runtime.
But at edit time it provides a “Load bundlePath/index.js failed!” error.

Since the editor is ready to entry all of the recordsdata to suggest them once you click on on a property of a sort that extends Asset, there needs to be a option to do the identical form of parsing in a code that runs at edit time.
But I but have to seek out how.

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here