// Use this for initialization void Start() { boxProduct = new BoxProductSelector(); GameObject box = Instantiate <GameObject>(boxPrefab); BoxComponent boxComponent = box.GetComponent <BoxComponent>(); str_boxProduct = boxProduct.GetSuitableBoxProduct(boxComponent.mySize); boxComponent.InitializeBox(str_boxProduct); }
public void InitializeBox(BoxProductSelector.Str_BoxProduct boxProduct) { myProduct = boxProduct.product; this.GetComponentInChildren <MeshFilter>().mesh = boxProduct.boxMesh; }