I am working on a project in react and I'm trying to change the texture of a mesh I'm working with but I am having trouble accessing the material property. Whenever I log the object to console I can see the material property but I cannot access it by 'mesh.material'. Anyone familiar with this issue?
import React, { useMemo } from 'react';
import { useGLTF, useTexture } from 'drei';
import modelConfig from '../../config/model.config';
const gltfModel = useGLTF(modelConfig.path.meshes, true);
gltfModel.scene.castShadow = true;
gltfModel.scene.receiveShadow = true;
const mesh = gltfModel.scene.getObjectByName("Floor")
console.log(mesh);