Sunday, July 24, 2022
HomeGame DevelopmentCannot override cc.assetManager.downloader.register('.json') - Cocos Creator

Cannot override cc.assetManager.downloader.register(‘.json’) – Cocos Creator


As described right here: Obtain and Parse ยท Cocos Creator we will override the built-in obtain technique for any asset.

So what i do:

cc.assetManager.downloader.register('.json', (url, choices, onComplete) => {
	const oReq = new XMLHttpRequest();
	oReq.open('GET', url, true);

	oReq.onload = (oEvent) => {
		onComplete?.(null, JSON.parse(oReq.response));
	};

	oReq.ship(null);
});

Thats it, nothing else. And this code not engaged on native platforms. I get errors like this:
Simulator[] nil host utilized in name to allowsSpecificHTTPSCertificateForHost

After that i simply opened cocos-engine/download-file.js at 793ed1e41a1e981ef927cb5ecccb6f051f942b50 ยท cocos/cocos-engine ยท GitHub
and copied the code from downloadFile technique in my operate.

That is additionally not engaged on native platforms.

So what ought to i do to repair this?


RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments