I'm using objFileLoader and doing something like this:
const task =
this._assetManager.addMeshTask('task', '', 'models/', 'myObj.obj');
task.onSuccess = (t) => {
console.dir(t.loadedMeshes[0].material);
console.dir(t.loadedMeshes[0]);
};
In the browser console, the first printed item is "undefined". second item is the loaded mesh. but if I inspect the printed mesh object, its "material" property is there.
This probably means the material is being loaded asynchronously but somehow the assets manager doesn't consider that as part of the task, so is saying the task is successful although the material is still being loaded.
I'll have a look!
I'll introduce a new observable: mesh.onMaterialChangedObservable
So as the material loading is asynchronous for obj loading you can still use the addMeshTask.onSuccess to register to this observable