Radar.cs 613 B

123456789101112131415161718192021222324252627
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class Radar : MonoBehaviour
  5. {
  6. // Start is called before the first frame update
  7. void Start()
  8. {
  9. }
  10. // Update is called once per frame
  11. void Update()
  12. {
  13. }
  14. private void OnTriggerEnter(Collider other) {
  15. if( other.gameObject.layer == LayerMask.NameToLayer("Invisible")){
  16. foreach(Transform tran in other.gameObject.GetComponentsInChildren<Transform>()){
  17. tran.gameObject.layer = LayerMask.NameToLayer("LiDAR");
  18. }
  19. }
  20. }
  21. }