diff --git a/UnboundLib/Cards/CustomCard.cs b/UnboundLib/Cards/CustomCard.cs index 00ad3a2..af7acba 100644 --- a/UnboundLib/Cards/CustomCard.cs +++ b/UnboundLib/Cards/CustomCard.cs @@ -24,9 +24,21 @@ private void Awake() { cardInfo = gameObject.GetOrAddComponent(); gun = gameObject.GetOrAddComponent(); + if (gun.objectsToSpawn == null) + { + gun.objectsToSpawn = new ObjectsToSpawn[0]; + } + if (gun.projectiles == null) + { + gun.projectiles = new ProjectilesToSpawn[0]; + } cardStats = gameObject.GetOrAddComponent(); statModifiers = gameObject.GetOrAddComponent(); block = gameObject.GetOrAddComponent(); + if (block.objectsToSpawn == null) + { + block.objectsToSpawn = new List(); + } SetupCard(cardInfo, gun, cardStats, statModifiers, block); } @@ -171,7 +183,8 @@ public static void BuildCard(Action callback) where T : CustomCard public static void BuildUnityCard(GameObject cardPrefab, Action callback) where T : CustomCard { - CardInfo cardInfo = cardPrefab.GetComponent(); + CardInfo cardInfo = cardPrefab.GetOrAddComponent(); + PhotonView view = cardPrefab.GetOrAddComponent(); CustomCard customCard = cardPrefab.GetOrAddComponent(); cardInfo.cardBase = customCard.GetCardBase(); @@ -201,7 +214,8 @@ public static void BuildUnityCard(GameObject cardPrefab, Action cal public void BuildUnityCard(Action callback) { - CardInfo cardInfo = this.gameObject.GetComponent(); + CardInfo cardInfo = this.gameObject.GetOrAddComponent(); + PhotonView view = this.gameObject.GetOrAddComponent(); CustomCard customCard = this; GameObject cardPrefab = this.gameObject;