- Home /
Change/load a mesh texture
Hello there. I looking for how to interact on a mesh composed to different parts (each part have a different texture), and when I click on a part.... that's change/load a new texture.
I found different documentation about OnMouseUp, Tags, OnControllerColliderHit, hit:RaycastHit, renderer.material... But at least, I am completely confused to... how mix all of these element !!!
Does anyone have an idea please ? Thanks.
Answer by DaveA · Dec 15, 2012 at 01:35 AM
You'll need to find the submesh hit, which will tell you which material to affect. See this answer: http://answers.unity3d.com/questions/291853/raycasthit-triangleindex-and-submeshes-which-subme.html
Answer by Hervus · Dec 15, 2012 at 04:13 PM
Thanks Dave. I have a question about this answer : - where should I specify each static mesh name ? GetMesh(gameObject) or submesh index:{1}... - and same question for Textures ?
I am always hallucinating to notice that is needed so much code to create such a simple interaction!!! :)
Your answer
![](https://koobas.hobune.stream/wayback/20220613085438im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to switch the texture being used by the material of the mesh renderer 1 Answer
How to switch texture of several 3D objects on GUI buttons click? 1 Answer
How do you dynamically tile sub-portions of a plane? 1 Answer
Making only some parts of a 3D object's texture transparent 1 Answer
How can I "generate a mesh" for a projected image or decal? 0 Answers