I have a pickup in my game that transforms the scale of my player object when it collides with it. the problem I am having is that when ever i make duplicates/childs of the parent object (pickup) the local scale transform does not replicate over onto the other pickups there for when the player collides with them it gets destroyed but the player does not get scaled again.
public class PickupCollsion : MonoBehaviour {
void OnTriggerEnter( Collider other)
{
if(other.tag == "Player") // if the tag of the gameobject is player the pickup gets removed
{
Vector3 newScale = transform.localScale; // sets newscale for the player
newScale *= 1.2f; //new scale value for the player
other.transform.localScale = new Vector3(1.2f, 1.2f, 1.2f); // the players x, y, z values will gbe increased by these values
Destroy(gameObject); //Pickup gameobject gets destroyed on collision
}
}