Gameobject instantiation returns null

So i have a piece of code where i am instantiating an object to use it later as reference to other gameobjects

public GameObject StandardEmpty;
    public string NameOfTurret;
    public bool IsDouble;
    public GameObject T_Bases;
    public GameObject T_Swivel;
    public List<GameObject> T_Mount = new List<GameObject>();
    public List<GameObject> T_Head = new List<GameObject>();
    public List<GameObject> T_Breech = new List<GameObject>();
    public List<GameObject> T_Barrel = new List<GameObject>();
    public List<GameObject> Mount_Connectors = new List<GameObject>();
    public List<GameObject> Breech_Connectors = new List<GameObject>();
    public TurretManager TurretSaveData;
    public TurretScriptable TempSavePoint;
    BuilderSync UpdateUI;
    TurretScriptable Turret;
    GameObject New_Empty;
    GameObject New_Bases;
    GameObject New_Swivel;
    GameObject New_Mount;
    GameObject New_Head;
    GameObject New_Breech_Center;
    GameObject New_Breech_Left;
    GameObject New_Breech_Right;
    GameObject New_Weapon_Barrel_Center;
    GameObject New_Weapon_Barrel_Left;
    GameObject New_Weapon_Barrel_Right;
    public Vector3 Build_Position;
    PartsAssembler PartAssembly;
    // i need to make it so it saves the part as soon as its selected not when im done creating the full turret (i think its done)
    public void Activation(int TurretIndex) //the turret index is going to tell what scriptable object index its going to save to
    {
        New_Empty = Instantiate(StandardEmpty.gameObject, Build_Position, Quaternion.identity) as GameObject;
        New_Empty.name = NameOfTurret;
        Bases(New_Empty);
        print(New_Empty.transform);
        TurretSaveData.Turrets[TurretIndex].TurretParts.Insert(0, StandardEmpty);
        TempSavePoint.TurretParts.Insert(0, StandardEmpty);
        PartAssembly.StartSync();
        ChangeChecker(TurretIndex);
    }
    /// <summary>
    /// This funtion is the activatior of this script
    /// </summary>

and i am getting a null reference at the new_empty

void Bases(GameObject NewEmpty)
        {
            New_Bases = Instantiate(T_Bases.gameObject, Build_Position, Quaternion.identity, NewEmpty.transform) as GameObject;
            Swivel(New_Bases);
            TempSavePoint.TurretParts.Insert(1, New_Bases);
        }
        /// <summary>
        /// This funtion creates a new Bases object in the given location
        /// </summary>
        void Swivel(GameObject Bases)
        {
            Transform TSwivel = Bases.transform.Find("*SOCKET_SWIVEL");
            New_Swivel = Instantiate(T_Swivel.gameObject, TSwivel.position, Quaternion.identity, TSwivel) as GameObject;
            TempSavePoint.TurretParts.Insert(2, New_Swivel);
        }
        /// <summary>
        /// This funtion places a new Swivel object in the given socket
        /// </summary>

and that carries over to these functions which are chained and it is unclear to me why its returning as a null even thought they get spawned and they are stored in a variable, any help is appreciated.

you have to use “ref” or “out” when you want to pass your gameobject as reference not a copy of variable. you can read link text

if you want to understand why. so in your case this will solve your problem

   Bases(ref New_Empty);
void Bases(ref GameObject NewEmpty)
         {
             New_Bases = Instantiate(T_Bases.gameObject, Build_Position, Quaternion.identity, NewEmpty.transform) as GameObject;
             Swivel(New_Bases);
             TempSavePoint.TurretParts.Insert(1, New_Bases);
         }
         /// <summary>
         /// This funtion creates a new Bases object in the given location
         /// </summary>
         void Swivel(GameObject Bases)
         {
             Transform TSwivel = Bases.transform.Find("*SOCKET_SWIVEL");
             New_Swivel = Instantiate(T_Swivel.gameObject, TSwivel.position, Quaternion.identity, TSwivel) as GameObject;
             TempSavePoint.TurretParts.Insert(2, New_Swivel);
         }
         /// <summary>
         /// This funtion places a new Swivel object in the given socket
         /// </summary>