how to make an object move like the one it is in contact(moving using Animator) with in unity?

I am new to unity. I am currently trying to create a basic 3 D game in which a game object is needed to jump on a moving platform and move along with it until i use my controls to move it like usual. I used an Animator to move the platform back and forth between 2 points. I had Rigid body on the game object and Mesh Collider on the platform.

When i play it now the game object falls on the platform but if does not move along with the platform but it stays in the same position from where it falls on the platform until the platform moves away and then it falls down.
How to make it move along with the platform when it in Contact with it? I hope this is understandable

Make the player a child of the platform when he is grounded on it and remove the parent when he is not on the platform. I would put a rigidbody on the platform as well and turn it to kinematic.

//when in contact with the platform
player.transform.parent = platform.transform;

And when the player gets off the platform:

player.transform.parent = null;