Hello!
I have made some outfits for my character, and now i want to make a basic “change outfit” script by pressing some canvas buttons to have a start to go further with.
However, when i have 1 button function in the script for button0 and Dress0 it works as it should do, but when i add a function for button1 and Dress 1 it will just add both outfits on/off at same time on both buttons, any tips to prevent that?
I have the actually script on the character and i have draged the character to each button and the function “ClickButton” is also correct on each button setting ( On Click() ).
CODE:
public class Outfit0 : MonoBehaviour {
public Button Button0;
public Button Button1;
public Button Button2;
public Button Button3;
public Button Button4;
public Button Button5;
public GameObject Dress0;
public GameObject Dress1;
public GameObject Dress2;
public GameObject Dress3;
public GameObject Dress4;
public GameObject Dress5;
public void ClickButton(string buttonID)
{
if (Button0)
Dress0.active = !Dress0.active;
if (Button1)
Dress1.active = !Dress1.active;
}
}