Obj Loader and materials

I am trying to add a material to an .obj file that I have and would like to add the MeshBasicMaterial to it but I am not able to find any information on it. This is what I have so far. It doesn’t work

loader.load(‘assets/tinker.obj’,function( object ){
const material = new THREE.MeshBasicMaterial({
color: 0xffff00
});
const mesh = new THREE.Mesh( object, material);
object.scale.set(0.2,0.2,0.2);
scene.add( mesh );
},
function( xhr ){
console.log(( xhr.loaded / xhr.total * 100) + ‘% 100’);
},
function( error ){
console.log(‘An error happend’);
}
);

loader.load(‘assets/tinker.obj’,function( object ){
const material = new THREE.MeshBasicMaterial({
color: 0xffff00
});
const mesh = object;
object.material=material;
object.scale.set(0.2,0.2,0.2);
scene.add( mesh );
},
function( xhr ){
console.log(( xhr.loaded / xhr.total * 100) + ‘% 100’);
},
function( error ){
console.log(‘An error happend’);
}
);

I tried to use the code you posted and it still didn’t work. Do you know how you would do it from scratch?

Maybe there error in console. Can you upload full archive?

loader.load(‘assets/tinker.obj’,function( object ){

const material = new THREE.MeshBasicMaterial({
color: 0xffff00
});

object.traverse( function ( child ) {
if ( child.isMesh ) child.material=material;
} );

object.scale.set(0.2,0.2,0.2);
scene.add( object );
},
function( xhr ){
console.log(( xhr.loaded / xhr.total * 100) + ‘% 100’);
},
function( error ){
console.log(‘An error happend’);
}
);