hi, im very very new to this,and im not very good at programing.
the question is this:
i have my player and 3 different objects, i want to change the material of my player when i collide with them, for ex: when the player hits a sphere (lets say A) it should get the material from that sphere(the sphere A material)
this is the code i have written so far to detect the collision with the objects (im using c# btw)
void OnTriggerEnter(Collider other)
{
if (other.gameObject.name == "BasicFire")
{
Destroy (other.gameObject);
}
else if (other.gameObject.name == "BasicWater")
{
Destroy (other.gameObject);
}
else if (other.gameObject.name == "BasicGrass")
{
Destroy (other.gameObject);
}
}