public void Add(Product product) { ProductItemView productView = CreateProductView(product); productView.transform.parent = _grid.transform; _grid.repositionNow = true; _grid.Reposition(); }
private ProductItemView CreateProductView(Product product) { GameObject source = (GameObject)Resources.Load("UI/ProductItem", typeof(GameObject)); GameObject go = Instantiate(source, _grid.transform); go.transform.localPosition = Vector3.zero; go.transform.localEulerAngles = Vector3.zero; go.transform.localScale = Vector3.one; ProductItemView productView = go.GetComponent <ProductItemView>(); productView.Init(product); return(productView); }