using System.Collections; using System.Collections.Generic; using UnityEngine; public class DisplaceAll : MonoBehaviour { public GameObject objects1; public GameObject objects2; public GameObject objects3; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } public void displaceAll() { Transform[] children = this.objects1.GetComponentsInChildren(true); Transform[] children2 = this.objects2.GetComponentsInChildren(true); Transform[] children3 = this.objects3.GetComponentsInChildren(true); foreach(Transform ch in children) { if(ch.gameObject.name.Contains("QR") && !ch.gameObject.name.Contains("AA")) ch.position = new Vector3(0.0f, 10000.0f, 0.0f); } foreach(Transform ch in children2) { if(ch.gameObject.name.Contains("QR") && !ch.gameObject.name.Contains("AA")) ch.position = new Vector3(0.0f, 10000.0f, 0.0f); } foreach(Transform ch in children3) { if(ch.gameObject.name.Contains("QR") && !ch.gameObject.name.Contains("AA")) ch.position = new Vector3(0.0f, 10000.0f, 0.0f); } } }