//public Fish GenerateFish (int id, Transform parent) public Fish GenerateFish(string id, Transform parent) { //Fish fish = new Fish (); GameObject obj = Instantiate(FishPrefab, parent) as GameObject; //obj.transform.SetParent(transform); Fish fish = obj.GetComponent <Fish>(); //FishInfo info = m_InfoFactory.CloneFishInfo (fishID: id); FishInfo info = DbMgr.s_Instance.GetFishInfo(id); fish.InitFish(info); fish.InitFishUI(); if (info.m_FishID != "") { Sprite newsprite = Resources.Load <Sprite>(AssetPathConstant.FOLDER_FISH_PATH + "/" + info.m_FishID); SpriteRenderer render = obj.GetComponent <SpriteRenderer>(); render.sprite = newsprite; Vector2 pixelSize = render.sprite.rect.size; Vector2 units = pixelSize / render.sprite.pixelsPerUnit; fish.SetUIOffetY(units.y / 2 + Constant.FISH_UI_OFFSETY); } fish.ActivateUI(true); return(fish); //FishInfo info = }