public static ShopThingHelper CreateShopThingsHelper(GameObject prefab, RectTransform parent, ShopThingData shopThingData) { if (!prefab) { return(null); } GameObject shopThing = UnityEngine.Object.Instantiate(prefab); shopThing.transform.localScale = parent.transform.lossyScale; shopThing.transform.SetParent(parent.transform); ShopThingHelper sC = shopThing.GetComponent <ShopThingHelper>(); sC.SetData(shopThingData); return(sC); }
public static ShopThingHelper CreateShopThingsHelper(GameObject prefab, RectTransform parent, ShopThingData shopThingData) { if (!prefab) { return(null); } prefab.GetComponent <ShopThingHelper>().SetImages(shopThingData.thingImage, shopThingData.thingLabelImage); // fix 2019 unity GameObject shopThing = Instantiate(prefab); shopThing.transform.localScale = parent.transform.lossyScale; shopThing.transform.SetParent(parent.transform); ShopThingHelper sC = shopThing.GetComponent <ShopThingHelper>(); sC.SetData(shopThingData); return(sC); }