Saturday, April 27, 2024
HomeGame DevelopmentHow you can use executeInEditMode and assetManager collectively ? (3.6) - Cocos...

How you can use executeInEditMode and assetManager collectively ? (3.6) – Cocos Creator


Hiya,

I’ve some code that entry belongings bundle by the assetManager and works high-quality 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 upfront.


Any thought ? 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 upfront all the pieces it accommodates.
loadAny doesn’t appear to have the ability to load a bundle from what I’m making an attempt.

I regarded on the implemetation of the loadBundle methodology within the engine and it does use loadAny.
In case you name
assetManager.loadAny({url : "bundleName", preset: "bundle", ext: "bundle", __isNative__: "true"}, (error, information) => { if (error != null) { console.error(error); } console.log(information); })
Like it’s completed within the loadBundle implementation, it does offer you an object at runtime.
However at edit time it provides a “Load bundlePath/index.js failed!” error.

For the reason that editor is ready to entry all of the information to suggest them once you click on on a property of a sort that extends Asset, there needs to be a technique to do the identical type of parsing in a code that runs at edit time.
However I but have to seek out how.



1 Like

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments