DisplaceAll.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class DisplaceAll : MonoBehaviour
  5. {
  6. public GameObject objects1;
  7. public GameObject objects2;
  8. public GameObject objects3;
  9. // Start is called before the first frame update
  10. void Start()
  11. {
  12. }
  13. // Update is called once per frame
  14. void Update()
  15. {
  16. }
  17. public void displaceAll()
  18. {
  19. Transform[] children = this.objects1.GetComponentsInChildren<Transform>(true);
  20. Transform[] children2 = this.objects2.GetComponentsInChildren<Transform>(true);
  21. Transform[] children3 = this.objects3.GetComponentsInChildren<Transform>(true);
  22. foreach(Transform ch in children)
  23. {
  24. if(ch.gameObject.name.Contains("QR") && !ch.gameObject.name.Contains("AA"))
  25. ch.position = new Vector3(0.0f, 10000.0f, 0.0f);
  26. }
  27. foreach(Transform ch in children2)
  28. {
  29. if(ch.gameObject.name.Contains("QR") && !ch.gameObject.name.Contains("AA"))
  30. ch.position = new Vector3(0.0f, 10000.0f, 0.0f);
  31. }
  32. foreach(Transform ch in children3)
  33. {
  34. if(ch.gameObject.name.Contains("QR") && !ch.gameObject.name.Contains("AA"))
  35. ch.position = new Vector3(0.0f, 10000.0f, 0.0f);
  36. }
  37. }
  38. }