void addToComponents(GBase b, GameObject go) { GComponent com = go.GetComponent <GComponent>(); components.Add(com); com.Load(b); if (com.Type == typeof(GFile)) { go.GetComponent <UIClickListener>().AddDownListener(UIClickListener.Type.LeftClick, () => { controller.getUI.onFileLeftClicked(com); }); } else if (com.Type == typeof(GFolder)) { go.GetComponent <UIClickListener>().AddDownListener(UIClickListener.Type.LeftClick, () => { controller.getUI.onFolderLeftClicked(com); }); } }