How to use executeInEditMode and assetManager together ? (3.6)

Hello,

I have some code that access assets bundle through the assetManager and works fine at runtime.
I’d want this code to also run in edit mode, but the loading fails in that case.

How do you access assets programmatically while in edit mode ?
I’m in 3.6.

Thanks in advance.

Any idea ? I don’t find anything in docs or api.

you can use assetManager.loadAny, here is a demo:
57210.zip (2.4 MB)

1 Like

loadAny works in editmode to load one file but I need to load an entire bundle not knowing in advance everything it contains.
loadAny doesn’t seem to be able to load a bundle from what I’m trying.

I looked at the implemetation of the loadBundle method in the engine and it does use loadAny.
If you call
assetManager.loadAny({url : "bundleName", preset: "bundle", ext: "bundle", __isNative__: "true"}, (error, data) => { if (error != null) { console.error(error); } console.log(data); })
Like it is done in the loadBundle implementation, it does give you an object at runtime.
But at edit time it gives a “Load bundlePath/index.js failed!” error.

Since the editor is able to access all the files to propose them when you click on a property of a type that extends Asset, there should be a way to do the same kind of parsing in a code that runs at edit time.
But I yet have to find how.

1 Like