using System.Collections; using System.Collections.Generic; using UnityEngine; public class Floor : MonoBehaviour { [SerializeField] float moveSpeed = 200f; void FixedUpdate() { transform.Translate(0,moveSpeed*Time.deltaTime,0); if(transform.GetComponent().anchoredPosition.y > 0f){ Destroy(gameObject); transform.parent.GetComponent().SpawnFloor(); } } }