Moving Platform And Character Size

Hello everyone, i’m working on 2d platform game. I have a problem with moving platform. The platform moves on the y-axis. When my 2d character jump on the platform and if i move my character on platform, character size getting smaller.What’s the solutions? Where is the problem?
My Code here //

void OnCollisionEnter2D(Collision2D col)

{

if (col.gameObject.tag.Equals(“HareketliZemin”))

{

this.transform.parent = col.transform;

}

}

void OnCollisionExit2D(Collision2D col)

{

if (col.gameObject.tag.Equals(“HareketliZemin”))

{

this.transform.parent = null;

}

}


How did you set up Collision2D col ?

Platform movement code //

public class ZeminHareket : MonoBehaviour
{
float speed = 2f;
bool yukari = true;

void Start()
{

}

void FixedUpdate()
{
if (transform.position.y > 1)
{
yukari = false;
}
if (transform.position.y < -5)
{
yukari = true;
}
if (yukari)
{
transform.position = new Vector2(transform.position.x, transform.position.y + speed * Time.deltaTime);
}
else
{
transform.position = new Vector2(transform.position.x, transform.position.y - speed * Time.deltaTime);
}
}

}

I don’t understand exactly what you mean.I’m beginner :frowning:

Hm, I 'm not sure either but if y changes during fixed update and your character inherits y of a parent,
then this could explain it.But, I’m not also sure how to fix it.