- Home /
cube texture change
i have two cubes CUBE1 and CUBE2 when user clicks on button1 the texture of cube1 should change when user clicks on button2 the texture of cube2 should change and in single GUI.label i should display which cube(cube1 or cube2) is clicked by the user
if(GUI.Button(Rect(Screen.width*(3/6.55),Screen.height*(2/6.3),Screen.width* (1/6.55),Screen.height*(0.4/6.3)),"CUBE1")) { table7 = true; cube3.renderer.material.mainTexture = texture1; cube4.renderer.material.mainTexture = texture3; camera1.enabled = true; camera2.enabled = false; } } if(d2 == true) { if(GUI.Button(Rect(Screen.width*(3/6.55),Screen.height*(2.5/6.3),Screen.width* (1/6.55),Screen.height*(0.4/6.3)),"CUBE2")) { table7 = true; cube4.renderer.material.mainTexture = texture2; cube3.renderer.material.mainTexture = texture3; camera2.enabled = true; camera1.enabled = false; } }
if(table7 == true) { GUI.Label(Rect(200, 150, 300, 100), "YOU HAVE CLICKED ON: "+ renderer); }
Your answer
Follow this Question
Related Questions
Random place changement 2 Answers
Why is my texture upside down on the other side of my cube? 6 Answers
Childs material 1 Answer
How do I add a texture to a cube with different faces? 1 Answer