public GUIObject(Action<GUIObject> readyCallback = null) { _readyCallback = readyCallback; _isReady = false; _mc = MainCanvas.Get(); _box = new GameObject("", typeof(RectTransform)); _box.name = typeof(GUIObject).ToString(); _box.transform.SetParent(_mc.canvas().transform, false); _triggerHandler = _box.AddComponent<GUITriggerHandler>(); EventTrigger eventTrigger = _box.AddComponent<EventTrigger>(); foreach (EventTriggerType type in Enum.GetValues(typeof(EventTriggerType))) { EventTrigger.Entry entry = new EventTrigger.Entry(); entry.eventID = type; entry.callback.AddListener(_triggerHandler.handler(type)); eventTrigger.triggers.Add(entry); } _children = new SortedDictionary<string, GUIObject>(Utilities.StringComparer.Get()); _name = ""; _id = Serialization.generateUUID(_box); Debug.Log("id: " + _id); GOCallback cb = _box.AddComponent<GOCallback>(); cb.startCallback = (go) => { _gameobjectInit(); GameObject.Destroy(go.GetComponent<GOCallback>()); }; }