public void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); return; } }
public void Initialize(Card card, CardViewManager manager) { CardViewManagerRef = manager; LinkedCard = card; LinkedCardInfo = card.Info; CardGraphicsRef = graphicsRootRef; //instantiate the ui components background = Instantiate(LinkedCardInfo.cardBackgroundPref, graphicsRootRef).GetComponent <CardUIBackground>(); illustration = Instantiate(LinkedCardInfo.cardIllustrationPref, graphicsRootRef).GetComponent <CardUIIllustration>(); foreground = Instantiate(LinkedCardInfo.cardForegroundInfoPref, graphicsRootRef).GetComponent <CardUIForeground>(); //initialize the components illustration.Initialize(LinkedCardInfo, this); foreground.Initialize(LinkedCardInfo); }