public void InitialiseCard(CardInfo info) { // setup card graphics _cardInfo = info; _cardIcon.sprite = _cardInfo.CardIcon; _cardName.text = _cardInfo.CardName; _cardDescription.text = _cardInfo.CardDescription; _cardType = _cardInfo.CardType; _cardTypeText.text = _cardType.GetTypeString(); // setup card logic _cardAttributes = _cardInfo.CardAttributes; _cardCostValue.text = _cardAttributes.BaseCardCost.ToString(); _cardType.OnInitCard(); try { _cardLogic = this.gameObject.GetComponent <CardLogic>(); } catch (NullReferenceException e) { Debug.Log("card does not have accompanying logic. Adding class..."); var temp = this.gameObject.AddComponent <CardLogic>(); _cardLogic = temp; } }