When my player collided with a button"GAMEOBJECT" change the scale to big and the button is actived
When i collide again change my player scale to small and the button is disabled.
How can i do that?
//My player
public GameObject Player;
//Materials
public Material[] material;
Renderer rend;
void Start()
{
//RenderMaterial
rend = GetComponent<Renderer>();
rend.enabled = true;
}
private void OnCollisionEnter(Collision coll)
{
//Change to Big
if(coll.gameObject == Player)
{
rend.sharedMaterial = material[0];
Player.transform.localScale = new Vector3(5, 5, 5);
}
//Change to Small
if (coll.gameObject == Player)
{
rend.sharedMaterial = material[1];
Player.transform.localScale = new Vector3(1, 1, 1);
}
}
}