trnasform ubnity
using UnityEngine; public class Example : MonoBehaviour { // Moves all transform children 10 units upwards! void Start() { foreach (Transform child in transform) { child.position += Vector3.up * 10.0f; } } }
Here is what the above code is Doing:
1. The foreach loop iterates through all the children of the transform component of the GameObject that the script is attached to.
2. The child.position += Vector3.up * 10.0f; line moves the child 10 units upwards.