Hi, I’m trying to instantiate a MonoBehavior Class “CardActions” that will have a parameter “Card” which will be a Normal Class.
Card newCard = new Card(cardNumber, cardID, nbCardsInHand);
Instantiate(cardPrefab); //Gameobject prefab that has "CardActions" as component
cardPrefab.GetComponent<CardActions>().setCard(newCard);
The problem with this (I think) is that “CardActions” don’t have the time to set his “default” parameters. So right after the call to setCard(newCard), CardActions sets his parameter Card to
Card card = new Card();
Is there any way I should do this? Maybe I’m totally off the track!
Thanks!