script
-
[3D]Destroy out of BoundsUnity(유니티) 2022. 7. 18. 14:14
일정 범위를 벗어나게 되면 오브젝트를 파괴 using System.Collections; using System.Collections.Generic; using UnityEngine; public class DestroyOutOfBounds : MonoBehaviour { private float topBound = 30; private float lowerBound = -10; // Update is called once per frame void Update() { if(transform.position.z > topBound) { Destroy(gameObject); } else if(transform.position.z < lowerBound) { Destroy(gameObject); } } }