Changing materials on different render meshes with diffuse images and lightmaps
Hello,
I’m currently working on a project where I need to change materials on different render meshes. Each render mesh has its own set of properties, including diffuse images and lightmaps. However, I’m facing some difficulties in achieving the desired outcome, and I would greatly appreciate your assistance and guidance.
Specifically, when I click to change the render mesh, I also want to update its material to reflect the corresponding diffuse image and lightmap. I have already tried a few approaches, but I haven’t been successful so far.
here is my project plz go through it https://playcanvas.com/editor/scene/1794152
thanks
Can you describe what code gets executed when you click that button? How do you change that material? A code snippet is enough. It is hard to say without spending time on investigating your project and browsing your files. And time is always short.
ok I have now done like this and it is working somehow. now the issue is if i am creating inserting shelf 3 or shelf 4 materials the last mesh material do not switching.
You should not use ChatGPT, as it often generates incorrect code.
Your code doesn’t seem to use mesh 3 or 4 anywhere. The best approach for you would be first to understand what each line of your code is doing. Copy-paste will never work properly.