using System.Collections; using System.Collections.Generic; using UnityEngine; public class MovingPlatform : MonoBehaviour { private void OnTriggerEnter(Collider other) { Debug.Log("trigger"); if(other.gameObject.CompareTag("Player")) { other.gameObject.transform.SetParent(transform); } } private void OnTriggerExit(Collider other) { if (other.gameObject.CompareTag("Player")) { other.gameObject.transform.SetParent(null); } } }