It’s like Mincecraft. I’ve made a prefab and I want to make it so that the selected texture from the menu (in the game) is used on the cube that is created. So example:
[YOUR PLAYING THE GAME]
You press “M” and a menu pops up with different textures. You choose the the texture you want and then your press “SPACE” and a cube is created with that texture.
Don’t know if it’s kind of same like I was asking these days… Check this out
var btnTexture : Texture;
var bumpMap : Texture;
function OnGUI() {
if (!btnTexture) {
Debug.LogError("Please assign a texture on the inspector");
return;
}
if (GUI.Button(Rect(10,10,50,50),btnTexture))
Debug.Log("Clicked the button with an image");
if (GUI.Button(Rect(10,70,50,30),"Click")){
Debug.Log("Clicked the button with text");
renderer.material.mainTexture=bumpMap;
}
}
Put this script on a cube for example and for the textures apply the texture you want to be displayed on the cube. Note that there are two textures that need to be applied, one will be applied to the cube and the other is for the GUI button.