Hi, I made a character customization script but I need some help with the system I am currently using. I have a room that is away from the main map that will show the character. I have the Player disabled as you can see in the script but when you change the skin it only changes the previews skin, not the player in the game. So how would I make it so the renderer.material.maintexture is applied to something else? Big thanks if you can help me!
EDIT
The issue with doing multiple things with the gui button is fixed, but I still need help with editing a different object.
Script:
#pragma strict
var guiSkin : GUISkin;
var player : GameObject;
var playerModel : GameObject;
var preview : GameObject;
var skin1 : Texture2D;
var skin2 : Texture2D;
var skin3 : Texture2D;
var btnTexture1 : Texture;
var btnTexture2 : Texture;
var btnTexture3 : Texture;
function Start()
{
player.active = false;
}
//How to change different object (playerModel) texture instead of object with the script applied to?
#pragma strict
var newname : String = "What's Your Name?";
var username : GameObject;
var guiSkin : GUISkin;
var ShowButton = true;
var player : GameObject;
var playerModel : GameObject;
var preview : GameObject;
var skin1 : Texture2D;
var skin2 : Texture2D;
var skin3 : Texture2D;
var btnTexture1 : Texture;
var btnTexture2 : Texture;
var btnTexture3 : Texture;
function Start()
{
player.active = false;
}
//How to change different object (playerModel) texture instead of //object with the script applied to?
function OnGUI() {
GUI.skin = guiSkin;
if (ShowButton) {
if (GUI.Button(Rect(250,250,100,100),btnTexture1))
renderer.material.mainTexture = skin1;
if (GUI.Button(Rect(450,250,100,100),btnTexture2))
renderer.material.mainTexture = skin2;
if (GUI.Button(Rect(650,250,100,100),btnTexture3))
renderer.material.mainTexture = skin3;
if (GUI.Button(Rect(450,400,100,50),"Done"))
{
player.active = true;
Destroy (preview);
ShowButton = false;
}
}
}