public void GenerateNewGadgetTemplate(GadgetTypes type, int amount) { GadgetTemplate newTemplate = Instantiate(gadgetTemplatePrefab, transform.position, Quaternion.identity).GetComponent <GadgetTemplate>(); Debug.Log(newTemplate); newTemplate.transform.SetParent(rt.transform); RectTransform templateRect = newTemplate.gameObject.GetComponent <RectTransform>(); int positionOffset = gadgets.Count - 1; if (templateRect == true) { Vector2 targetPos = rt.transform.position; templateRect.anchoredPosition = new Vector2(taskXOffset * positionOffset, taskYOffset); } Sprite icon = GetRespectiveIcon(type); newTemplate.SetUpTemplate(icon, amount, type); gadgets.Add(newTemplate); }
//! \brief Add the given gadget to this Window template. public void AddGadget(GadgetTemplate gadget) { Gadgets.Add(gadget); }