public static RectTransform AddViewToParent(
            this Transform parent,
            GameObject child,
            bool worldPositionStays)
        {
            RectTransform component = child.GetComponent <RectTransform>();

            component.SetParent(parent, worldPositionStays);
            UtilityGameObject.SyncLayer(parent.gameObject, child, false);
            return(component);
        }
 public static void SetLayer(GameObject target, int layer, bool recuresively)
 {
     if (!(bool)((UnityEngine.Object)target))
     {
         return;
     }
     target.layer = layer;
     if (recuresively)
     {
         for (int index = 0; index < target.transform.childCount; ++index)
         {
             UtilityGameObject.SetLayer(target.transform.GetChild(index).gameObject, layer, recuresively);
         }
     }
 }
 public static void SyncLayer(GameObject src, GameObject dst, bool recursive)
 {
     UtilityGameObject.SetLayer(dst, src.layer, recursive);
 }