c# list help!

I have a database of cards that I’m trying to make copies of the cards and add them to a new decklist but I keep getting an out of range error when using a list from one script in another script. When I do a debug.log using .count I get the right size in the script the list belongs to but not in the one calling it. So what am I doing wrong?

using UnityEngine;
using System.Collections;
 
public class CardClass
{
    public string _Name;//Re Ut
    public string _Color; //Ut
    public string _Race;
    public string _Rarity; //common, uncommon, rare Re Ut
    public int _OwnerID; //who currently controlls it Re Ut
    public int _CardID; //Match with other database Re Ut
    public int _TypeID; //Card type Re Ut
    public int _Class;//Ut
    public int _Cost1; //Lumber cost Ut
    public int _Cost2; //Ore Cost Ut
    public int _Cost3; //Crystal cost Ut
    public int _TextCost; //Re Ut
    public int _TextID; //0-13 Re Ut
    public int _Power;
    public int _Defense;
    public int _Range;
    public int _Speed;
 
    //Defualt
    public CardClass(){
       }
 
    //Unit, Ally, Structure Cards
    public CardClass(string Name, string color, string Race, string Rarity,
                     int OwnerID, int CardID, int TypeID, int Class, int Cost1, int Cost2,
                     int Cost3, int TextCost, int TextID, int Power, int Defense, int Range, int Speed){
 
 
          _Name = Name;
          _Color = color;
          _Race = Race;
          _Rarity = Rarity;
          _OwnerID = OwnerID;
          _CardID = CardID;
          _TypeID = TypeID;
          _Class = Class;
          _Cost1 = Cost1;
          _Cost2 = Cost2;
          _Cost3 = Cost3;
          _TextCost = TextCost;
          _TextID = TextID;
          _Power = Power;
          _Defense = Defense;
          _Range = Range;
          _Speed = Speed;
 
       }
 
 
       //Utility Cards
       public CardClass(string Name, string color, string Rarity, int OwnerID, int CardID, int TypeID, int Class, int Cost1, int Cost2, int Cost3, int TextCost, int TextID){
 
          _Name = Name;
          _Color = color;
          _Rarity = Rarity;
          _OwnerID = OwnerID;
          _CardID = CardID;
          _TypeID = TypeID;
          _Class = Class;
          _Cost1 = Cost1;
          _Cost2 = Cost2;
          _Cost3 = Cost3;
          _TextCost = TextCost;
          _TextID = TextID;
       }
 
 
       //Resource Cards
       public CardClass(string Name, string Rarity, int OwnerID, int CardID, int TypeID, int TextCost, int TextID){
 
          _Name = Name;
          _Rarity = Rarity;
          _OwnerID = OwnerID;
          _CardID = CardID;
          _TypeID = TypeID;
          _TextCost = TextCost;
          _TextID = TextID;
       }
 
}

Creating cards:

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
 
public class MainDataBase : CardClass {
 
    //public List<CardClass> MainDB = new List<CardClass> ();
 
          #region Unit
          // typeID = 1  Class: Meele = 1 Range = 2 Magic = 3   Rarity: Common, Uncommon, Rare, Omega  
          public CardClass Card0 = new CardClass ("Ember Berserker", "Red", "Dwarf", "Uncommon", 1, 0, 1, 1, 3, 0, 0, 0, 1, 3, 4, 1, 2);
 
          public CardClass Card1 = new CardClass ("Ember Lancer", "Red", "Dwarf", "Common", 1, 1, 1, 1, 1, 1, 0, 0, 0, 3, 3, 2, 2);
 
          public CardClass Card2 = new CardClass ("Ember Guardian", "Red", "Dwarf", "Uncommon", 1, 2, 1, 1, 2, 2, 0, 2, 2, 3, 5, 2, 1);
 
          public CardClass Card3 = new CardClass ("Ember Mage", "Red", "Dwarf", "Common", 1, 3, 1, 3, 0, 0, 3, 3, 3, 1, 2, 3, 3);
 
          public CardClass Card4 = new CardClass ("Ember Priest", "Red", "Dwarf", "Uncommon", 1, 4, 1, 3, 0, 0, 4, 3, 4, 1, 3, 4, 2);
 
          public CardClass Card5 = new CardClass ("Ember Hunter", "Red", "Dwarf", "Uncommon", 1, 5, 1, 2, 0, 2, 0, 0, 1, 2, 3, 4, 3);
 
          public CardClass Card6 = new CardClass ("Ember Gunner", "Red", "Dwarf", "Common", 1, 6, 1, 2, 1, 1, 0, 0, 0, 2, 2, 5, 3);
          #endregion
 
          #region Utility
          // typeID = 2  Class: Meele = 1 Range = 2 Magic = 3   Rarity: Common, Uncommon, Rare, Omega 
          public CardClass Card7 = new CardClass ("Cannon Tower", "Red", "Structure", "Uncommon", 1, 7, 2, 0, 2, 2, 0, 0, 5, 0, 4, 2, 0);
 
          public CardClass Card8 = new CardClass ("Mountain Lion", "Red", "Lion Ally", "Common", 1, 8, 2, 0, 0, 4, 0, 0, 0, 3, 3, 1, 3);
 
          public CardClass Card9 = new CardClass ("Lava Golem", "Red", "Golem Ally", "Rare", 1, 9, 2, 0, 0, 0, 6, 6, 6, 4, 4, 2, 3);
 
          public CardClass Card10 = new CardClass ("Burning Desire", "Red", "Rare", 1, 10, 2, 3, 0, 0, 4, 0, 7);
 
          public CardClass Card11 = new CardClass ("Hellfire", "Red", "Common", 1, 11, 2, 3, 0, 0, 3, 0, 8);
 
          public CardClass Card12 = new CardClass ("Healing Flames", "Red", "Common", 1, 12, 2, 3, 0, 0, 2, 0, 9);
 
          public CardClass Card13 = new CardClass ("Power Shot", "Red", "Common", 1, 13, 2, 2, 0, 3, 0, 0, 10);
 
          public CardClass Card14 = new CardClass ("Explosive Shot", "Red", "Uncommon", 1, 14, 2, 2, 0, 2, 2, 0, 11);
 
          public CardClass Card15 = new CardClass ("Flame Strike", "Red", "Common", 1, 15, 2, 1, 2, 0, 1, 0, 12);
 
          public CardClass Card16 = new CardClass ("War Cry", "Red", "Uncommon", 1, 16, 2, 1, 5, 0, 0, 0, 13);
          #endregion
 
          #region Resource
          // typeID = 3  Rarity: Common, Uncommon, Rare, Omega
          public CardClass Card17 = new CardClass ("Forest", "Common", 1, 17, 3, 0, 14);
 
          public CardClass Card18 = new CardClass ("Large Forest", "Uncommon", 1, 18, 3, 0, 15);
 
          public CardClass Card19 = new CardClass ("Quarry", "Common", 1, 19, 3, 0, 16);
 
          public CardClass Card20 = new CardClass ("Large Quarry", "Uncommon", 1, 20, 3, 0, 17);
 
          public CardClass Card21 = new CardClass ("Crystal Field", "Common", 1, 21, 3, 0, 18);
 
          public CardClass Card22 = new CardClass ("Large Crystal Field", "Uncommon", 1, 22, 3, 0, 19);
          #endregion
 
}

Adding to main database:

using UnityEngine; using System.Collections; using System.Collections.Generic;

public class MDBADD : MonoBehaviour {
 
    public List<CardClass> MainDB = new List<CardClass> ();
 
    public void AddToDB(){
 
      
   
 
       MainDB.Add (DB.Card0);
       MainDB.Add (DB.Card1);
       MainDB.Add (DB.Card2);
       MainDB.Add (DB.Card3);
       MainDB.Add (DB.Card4);
       MainDB.Add (DB.Card5);
       MainDB.Add (DB.Card6);
       MainDB.Add (DB.Card7);
       MainDB.Add (DB.Card8);
       MainDB.Add (DB.Card9);
       MainDB.Add (DB.Card10);
       MainDB.Add (DB.Card11);
       MainDB.Add (DB.Card12);
       MainDB.Add (DB.Card13);
       MainDB.Add (DB.Card14);
       MainDB.Add (DB.Card15);
       MainDB.Add (DB.Card16);
       MainDB.Add (DB.Card17);
       MainDB.Add (DB.Card18);
       MainDB.Add (DB.Card19);
       MainDB.Add (DB.Card20);
       MainDB.Add (DB.Card21);
       MainDB.Add (DB.Card22);
       Debug.Log (MainDB.Count);
}
}

this script makes a list that will be used to pull from the database and add to another list:

public class DeckLists : CardClass {
 
    public List<int> Deck1 = new List<int>();
 
    public void DeckA(){ 
 
          Deck1.Add (0);//1
          Deck1.Add (0);//2
          Deck1.Add (0);//3
          Deck1.Add (1);//4
          Deck1.Add (1);//5
          Deck1.Add (1);//6
          Deck1.Add (2);//7
          Deck1.Add (2);//8
          Deck1.Add (3);//9
          Deck1.Add (3);//10
          Deck1.Add (3);//11
          Deck1.Add (4);//12
          Deck1.Add (4);//13
          Deck1.Add (4);//14
          Deck1.Add (5);//15
          Deck1.Add (5);//16
          Deck1.Add (5);//17
          Deck1.Add (6);//18
          Deck1.Add (6);//19
          Deck1.Add (6);//20
          Deck1.Add (7);//21
          Deck1.Add (7);//22
          Deck1.Add (8);//23
          Deck1.Add (9);//24
          Deck1.Add (10);//25
          Deck1.Add (11);//26
          Deck1.Add (11);//27
          Deck1.Add (11);//28
          Deck1.Add (12);//29
          Deck1.Add (12);//30
          Deck1.Add (12);//31
          Deck1.Add (13);//32
          Deck1.Add (13);//33
          Deck1.Add (14);//34
          Deck1.Add (14);//35
          Deck1.Add (15);//36
          Deck1.Add (15);//37
          Deck1.Add (15);//38
          Deck1.Add (16);//39
          Deck1.Add (16);//40
          Deck1.Add (17);//41
          Deck1.Add (17);//42
          Deck1.Add (17);//43
          Deck1.Add (17);//44
          Deck1.Add (18);//45
          Deck1.Add (18);//46
          Deck1.Add (18);//47
          Deck1.Add (19);//48
          Deck1.Add (19);//49
          Deck1.Add (19);//50
          Deck1.Add (19);//51
          Deck1.Add (20);//52
          Deck1.Add (20);//53
          Deck1.Add (20);//54
          Deck1.Add (21);//55
          Deck1.Add (21);//56
          Deck1.Add (21);//57
          Deck1.Add (21);//58
          Deck1.Add (22);//59
          Deck1.Add (22);//60 
          Deck1.Add (0);//60
          Debug.Log (Deck1.Count);
 
       }
 
 
}

This script takes cards from the main database based on the value from the deck list and adds it to another list:

public class Card : CardClass
{
    MDBADD TDB = new MDBADD ();
 
    DeckLists Deck1 = new DeckLists();
 
    public List<CardClass> MDB = new List<CardClass>();
 
    public void Change(){
 
 
       int g = 0;
       int x = Deck1.Deck1 [g];
 
       for (int i = 0; i < 60; i++) {
 
         MDB.Add (TDB.MainDB[x]);
         g++;
         x = Deck1.Deck1 [g];
 
       }
    }

Then I have a start function call all the functions of the other scripts.

I have solved this issue. I had my inheritance all messed up and was making unnecessary new instance when I just needed chain inherited scripts. Thank you for your time.