Hi, I have two separate questions relative to this initial question.
Is it possible to define a generic Asset input into a component for a very specific extension file ?
In my case I would like to give support for .ldtk
files (which are just big json files)
If for whatever reason this is not possible, can you explain how to parse that very same file after loading it with assetManager
?
My code:
assetManager.parser.register('.ldtk', function (file, options, callback) {
// Parse the downloaded file
callback(null, file);
});
@ccclass('LDtk')
@executeInEditMode(true)
export class LDtk extends Component {
start() {
assetManager.loadAny({'uuid': '5473bf97-839e-4d11-af5d-acd2e30bfaf4'}, {isCrossOrigin: true}, (err, asset: Asset) => {
// I can just access to the file content with ._file but is private and doesnt seem the right way to do it
});
}
}