Im newer to unity. Im making a cube game where my cube has the tag “Player” set to it. I have a skin selector in my game that i want to allow the player to change the skin of the cube (just by changing the material) with a button. for some reason my button doesnt do anything to the player’s material. This is my code.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MaterialChanger : MonoBehaviour
{
public GameObject Player;
public Material skinMaterial;
private void OnMouseDown()
{
Player.GetComponent<MeshRenderer>().material = skinMaterial;
}
}