public GameObject SpawnItem(ItemScheme scheme, Transform parent) { GameObject itemGO = null; if (scheme != null) { itemGO = GameObject.Instantiate(scheme.itemPrefab, parent); if (itemGO != null) { var item = itemGO.GetComponent <Item>(); if (item != null) { item.Setup(scheme); } } } return(itemGO); }
//private void OnDestroy() //{ // GameplayManager.GetGameplayManager().RemoveFromCachedList(this); //} public void Setup(ItemScheme scheme) { this.scheme = scheme; }