private static void SetParentAndAlign(GameObject child, GameObject parent) { if (parent == null) { return; } child.transform.SetParent(parent.transform, false); TMP_DefaultControls.SetLayerRecursively(child, parent.layer); }
private static void SetLayerRecursively(GameObject go, int layer) { go.layer = layer; Transform transform = go.transform; for (int i = 0; i < transform.childCount; i++) { TMP_DefaultControls.SetLayerRecursively(transform.GetChild(i).gameObject, layer); } }