using UnityEngine; // Use this Script in parent folder of all Humans public class SetDiamondMaterial : MonoBehaviour { [Header("Diamond Materials:")] public Material year2019; public Material year2020; public Material year2021; // Start is called before the first frame update void Start() { Component[] allChild = GetComponentsInChildren(); // all possible children of parent object foreach (Transform child in allChild) { if (child.parent == allChild[0]) { if(child.CompareTag("2021")) { child.Find("BasicMotionsDummyModel").Find("diamond1").GetComponent().material = year2021; } else if (child.CompareTag("2020")) { child.Find("BasicMotionsDummyModel").Find("diamond1").GetComponent().material = year2020; } else if (child.CompareTag("2019")) { child.Find("BasicMotionsDummyModel").Find("diamond1").GetComponent().material = year2019; } } } } }