Answers for "get all component from children unity"

C#
7

unity get all children

foreach (Transform child in parent) {
  //Your code
}
Posted by: Guest on June-06-2020
1

unity get components in children

using UnityEngine;

public class GetComponentsInChildrenExample : MonoBehaviour
{
    public Component[] hingeJoints;

    void Start()
    {
        hingeJoints = GetComponentsInChildren<HingeJoint>();

        foreach (HingeJoint joint in hingeJoints)
            joint.useSpring = false;
    }
}
Posted by: Guest on July-30-2021

C# Answers by Framework

Browse Popular Code Answers by Language