public void ShowEntity(string entityName, string groupName, string luaName) { GameObject go = null; if (m_Entity.TryGetValue(entityName, out go)) { EntityLogic entityLogic = go.GetComponent <EntityLogic>(); entityLogic.OnShow(); return; } Manager.Resource.LoadPrefab(entityName, (UnityEngine.Object obj) => { go = Instantiate(obj) as GameObject; m_Entity.Add(entityName, go); EntityLogic entityLogic = go.AddComponent <EntityLogic>(); Transform parent = GetEntityGroup(groupName); go.transform.SetParent(parent, false); entityLogic.Init(luaName); entityLogic.OnShow(); }); }