- Home /
Trying to change material of player with a button through an item shop. not sure how to need help can't find answer
The Script i have connected to the players i would like to change color of is this
public Material skinMaterial;
void Awake()
{
gameObject.GetComponent<MeshRenderer>().material = skinMaterial;
}
alt text
this is the code i have for the button to change material of the player which is in all scenes
and for the i cant figure out how to make the skin material change on the inspector based on which button i press. i have the script on the buttons and on the main menu containing the buttons.
Answer by cavachie · May 10 at 05:28 AM
to add more details, when i am in game it always is gonna be whatever i have in the "skin Material" in the inspector for the menu. All of my buttons have different skin materials in it but the menu will always have the same and im not sure what to do.
I will award anyone who can help me ive been stuck on this for days.
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Multiple Cars not working 1 Answer
Texture2D to Texture3D 2 Answers
C# public - dropdown selection? 3 Answers
Why does new GUIStyle() give "object reference not set to an instance of an object" error? 1 Answer