How can I make a platform move only when the player is on it?

I have a cube that I use as a mobile platform, but would like it to move only when the player was on top of it. How can I do this?

Hi,

I think when you use an Trigger, the player would fall through the platform. So I would prefer to use OnCollisionStay.

public class MovePlatform : MonoBehaviour {
     void OnCollisionStay(Collision collisionInfo) {
          if (collisionInfo.gameObject.tag == "Player") {
                   // Move your platform here
          }
     }
}

All the best,
Klaus