public void UpdateHierarchy()
        {
            Transform rootScreen = this.transform.GetChild(0);

            WidgetManager manager = rootScreen.GetComponent <WidgetManager>();

            hierarchy.Clear();

            foreach (WidgetData data in manager.widgetContainer)
            {
                if (hierarchy.ContainsKey(data.layerName))
                {
                    hierarchy[data.layerName].Add(data);
                }
                else
                {
                    hierarchy.Add(data.layerName, new List <WidgetData>()
                    {
                        data
                    });
                }
            }
        }
        private void InitScreen()
        {
            if (this.screenPrefab == null)
            {
                Debug.LogError(this.name + " missing the prefab reference!");
                return;
            }

            if (this.screenInstance == null)
            {
                this.screenInstance = GameObject.Instantiate(this.screenPrefab);
            }

            //remove the parent object cause its only for prefab purposes
            GameObject tempParent = this.screenInstance;
            GameObject tempScreen = this.screenInstance.transform.GetChild(0).gameObject;



            //Remove the parent
            tempScreen.transform.SetParent(null);
            Destroy(tempParent);
            this.screenInstance = tempScreen;

            this.screenInstance.transform.SetParent(this.transform);

            this.widgetManager = this.screenInstance.GetComponent <WidgetManager>();

            //initialize the transitioncontroller
            this.transitionController = this.screenInstance.GetComponent <ScreenTransition>().AddController(this.screenInstance);
            this.transitionController.Init(this.screenInstance);

            //deactivate the root object
            root = this.screenInstance.transform.GetChild(0);
            root.gameObject.SetActive(false);
        }
 public void Awake()
 {
     this.widgetCollection = this.GetComponent <WidgetManager>();
 }