Example #1
0
        public static void Paste(GameObject newChild, CanvasTipology tipology = CanvasTipology.Null)
        {
            CanvasManager canvasManager = CanvasManager.Instance;

            if (newChild && canvasManager)
            {
                Transform parent = GetChild(tipology);
                if (!parent)
                {
                    parent = canvasManager.transform;
                }


                newChild.transform.SetParent(parent, false);
            }
        }
Example #2
0
        public static Transform GetChild(CanvasTipology tipology = CanvasTipology.Null)
        {
            CanvasManager canvasManager = CanvasManager.Instance;

            if (canvasManager)
            {
                string    tag    = tipology.ToString();
                Transform parent = canvasManager.transform;

                foreach (Transform child in canvasManager.transform)
                {
                    if (tag.Equals(child.name))
                    {
                        parent = child;
                        break;
                    }
                }

                return(parent);
            }
            return(null);
        }