Object pooling null reference

Ive been following the unity tutorial on object pooling and wrote it out and copied it into my script and monodevelop says everything is allright but when i play it gives me null reference on lines 31,100,144. ive been at it for a few days now and at my level i dont know what to do. if you help just help with the object pooling, the stamina and stuff is already solved and uninvolved.

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

public class PlayerMovement : MonoBehaviour {
    //movement
    public float moveSpeed=5;
    public float rotateSPeed= 5.0f;
    public float runSpeed=5.0f;
    //pooling bullets
    public GameObject bullet;
    public int pooledAmmount = 20;
    List <GameObject> bullets;


    //private CharacterController playerController;

    //stamina
    public float curStamina;
    public float maxStamina;
    public float StamDrain;
    public float StamRegen;
    public float staminaBarLength;
    private float timestamp;
    private bool CanRun;



    // fire rate
    public GameObject shot;
    public Transform shotSpawn;
    public float fireRate=0.5f;
    private float nextFire = 0.0f;


    // Use this for initialization
    //sprint
    void Start () {
        CanRun = true;
        staminaBarLength = Screen.width / 6;
        //newStamina= new PlayerStamina;
    //    playerController = GetComponent<CharacterController>();

        //pooled bullets
        bullets = new List<GameObject> ();
        for (int i=0; i< pooledAmmount; i++) {
                        GameObject obj = (GameObject)Instantiate (bullets);
                        obj.SetActive (false);
                        bullets.Add (obj);
                }
    }
    
    // Update is called once per frame
    void Update () {
        AdjustCurrentStamina (0);
        InvokeRepeating ("Regen", 0.0f, 5.0f/StamRegen);
        if (curStamina < 1) {
                        CanRun = false;        
                } else {
                        CanRun = true;
                }
        if (curStamina > maxStamina) {
            curStamina=maxStamina;}

        if (Input.GetKey("w")) {
                        
            transform.Translate((Vector3.forward)*moveSpeed*Time.deltaTime);
                }
        if (Input.GetKey("s")) {
            transform.Translate((Vector3.back)*moveSpeed*Time.deltaTime);
                }
        if (Input.GetKey("a")) {
            transform.Rotate (Vector3.down * rotateSPeed);
            //transform.Translate((Vector3.left)*moveSpeed*Time.deltaTime);
                }
        if (Input.GetKey("d")) {
            transform.Rotate (Vector3.up * rotateSPeed);
            //transform.Translate((Vector3.right)*moveSpeed*Time.deltaTime);
        }
        if(CanRun==true)
        {
         if(Input.GetKey ("left shift")&& Input.GetKey ("w")) {
            transform.Translate((Vector3.forward)*moveSpeed*runSpeed*Time.deltaTime);
                Drain();
                timestamp=Time.time;
            }
        else 
            {
                if(Input.GetKey ("left shift")&& Input.GetKey ("w")) {
                    transform.Translate((Vector3.forward)*moveSpeed*Time.deltaTime);}}

                Regen();
        }



        //shooting
        if(Input.GetKeyUp("space")&& Time.time > nextFire)
        {
            Fire();
//            nextFire= Time.time * fireRate;
//            //GameObject clone =
//            Instantiate(shot,shotSpawn.position,shotSpawn.rotation);
                //as GameObject;
        }

    }

    void OnGUI()
    {
        GUI.contentColor = Color.green;
        GUI.Box (new Rect (40, 60, staminaBarLength, 20), curStamina + "/" + maxStamina);
    }



    public void AdjustCurrentStamina(int adJ)
    {
        curStamina += adJ;
        
        if (curStamina < 0)
            curStamina = 0;
        
        if (curStamina > maxStamina)
            curStamina = maxStamina;
        if (maxStamina < 1)
            maxStamina = 1;
        
        staminaBarLength = (Screen.width / 6) * (curStamina / (float)maxStamina);
    }

    void Drain ()
    {
        curStamina -= StamDrain;
        }
    void Regen ()
    {
        if(curStamina<maxStamina &&Time.time > (timestamp + 5.0f))
        curStamina+=.5f;
    }

    void Fire ()
    {

                nextFire = Time.time * fireRate;
        GameObject obj = new ObjectPoolerScript.current.GetPooledObject;
        if (obj = null)
                        return;
                Instantiate (shot, shotSpawn.position, shotSpawn.rotation); 
        }

}

        
    
    and here is another one that pools them
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class ObjectPoolerScript : MonoBehaviour {

    public static  ObjectPoolerScript current;
    public GameObject PooledObject;
    public int pooledAmount=20;
    public bool willGrow=true;

    List<GameObject> pooledObjects;

    void Awake()
    {
                current = this;
        }
        

    // Use this for initialization
    void Start () {
        pooledObjects = new List<GameObject> ();
        for (int i=0; i<pooledAmount; i++) 
        {GameObject obj=(GameObject)Instantiate(PooledObject);
            obj.SetActive(false);
            pooledObjects.Add (obj);
                }
    }

    public GameObject GetPooledObject()
    {
                for (int i=0; i<pooledObjects.Count; i++) {
                        if (!pooledObjects *.activeInHierarchy) {*

return pooledObjects ;
}
}
if (willGrow) {
GameObject obj = (GameObject)Instantiate (PooledObject);
pooledObjects.Add (obj);
return obj;
}
return null;
}}

the script t first makes a set number of bullets then if it exceeds it makes a new one but it just makes my bullets and doesn’t fire and gives me a null reference.

This line:

GameObject obj = (GameObject)Instantiate (bullets);

Should be like:

GameObject obj = (GameObject)Instantiate (bullet);

What you are doing in your code when calling Instantiate(bullets), you are trying to instantiate the very same list which you have instantiated just a few lines before in:

 bullets = new List<GameObject> ();

And same thing applies to your second case of pooling.

player movement

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

public class PlayerMovement : MonoBehaviour {
    //movement
    public float moveSpeed=5;
    public float rotateSPeed= 5.0f;
    public float runSpeed=5.0f;
    //pooling bullets
//    public GameObject bullet;
//    public int pooledAmmount = 20;
//    List <GameObject> bullets;


    //private CharacterController playerController;

    //stamina
    public float curStamina;
    public float maxStamina;
    public float StamDrain;
    public float StamRegen;
    public float staminaBarLength;
    private float timestamp;
    private bool CanRun;



    // fire rate
    public GameObject shot;
    public Transform shotSpawn;
    public float fireRate=0.5f;
    private float nextFire = 0.0f;


    // Use this for initialization
    //sprint
    void Start () {
        CanRun = true;
        staminaBarLength = Screen.width / 6;

    }
    
    // Update is called once per frame
    void Update () {
        AdjustCurrentStamina (0);
        InvokeRepeating ("Regen", 0.0f, 5.0f/StamRegen);
        if (curStamina < 1) {
                        CanRun = false;        
                } else {
                        CanRun = true;
                }
        if (curStamina > maxStamina) {
            curStamina=maxStamina;}

        if (Input.GetKey("w")) {
                        
            transform.Translate((Vector3.forward)*moveSpeed*Time.deltaTime);
                }
        if (Input.GetKey("s")) {
            transform.Translate((Vector3.back)*moveSpeed*Time.deltaTime);
                }
        if (Input.GetKey("a")) {
            transform.Rotate (Vector3.down * rotateSPeed);
            //transform.Translate((Vector3.left)*moveSpeed*Time.deltaTime);
                }
        if (Input.GetKey("d")) {
            transform.Rotate (Vector3.up * rotateSPeed);
            //transform.Translate((Vector3.right)*moveSpeed*Time.deltaTime);
        }
        if(CanRun==true)
        {
         if(Input.GetKey ("left shift")&& Input.GetKey ("w")) {
            transform.Translate((Vector3.forward)*moveSpeed*runSpeed*Time.deltaTime);
                Drain();
                timestamp=Time.time;
            }
        else 
            {
                if(Input.GetKey ("left shift")&& Input.GetKey ("w")) {
                    transform.Translate((Vector3.forward)*moveSpeed*Time.deltaTime);}}

                Regen();
        }



        //shooting
        if(Input.GetKeyUp("space")&& Time.time > nextFire)
        {
            Fire ();
            //Invoke("Fire",nextFire);
//            //GameObject clone =
//            Instantiate(shot,shotSpawn.position,shotSpawn.rotation);
                //as GameObject;
        }

    }

    void OnGUI()
    {
        GUI.contentColor = Color.green;
        GUI.Box (new Rect (40, 60, staminaBarLength, 20), curStamina + "/" + maxStamina);
    }



    public void AdjustCurrentStamina(int adJ)
    {
        curStamina += adJ;
        
        if (curStamina < 0)
            curStamina = 0;
        
        if (curStamina > maxStamina)
            curStamina = maxStamina;
        if (maxStamina < 1)
            maxStamina = 1;
        
        staminaBarLength = (Screen.width / 6) * (curStamina / (float)maxStamina);
    }

    void Drain ()
    {
        curStamina -= StamDrain;
        }
    void Regen ()
    {
        if(curStamina<maxStamina &&Time.time > (timestamp + 5.0f))
        curStamina+=.5f;
    }

    void Fire ()
    {
            //nextFire = Time.time * fireRate;
        GameObject obj = ObjectPoolerScript.current.GetPooledObject ();
        if (obj == null) {return;}

        obj.transform.position = transform.position;
        obj.transform.rotation = transform.rotation;
        obj.SetActive (true);
                    //Instantiate (shot, shotSpawn.position, shotSpawn.rotation);
        }

}

Obeject pooler script
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class ObjectPoolerScript : MonoBehaviour {

public static  ObjectPoolerScript current;
public GameObject PooledObject;
public int pooledAmount=20;
public bool willGrow=true;

List <GameObject> pooledObjects;

void Awake()
{
            current = this;
    }
    

// Use this for initialization
void Start () {
    pooledObjects = new List<GameObject> ();
    for (int i=0; i<pooledAmount; i++) 
    {GameObject obj=(GameObject)Instantiate(PooledObject);
        obj.SetActive(false);
        pooledObjects.Add (obj);
            }
}

public GameObject GetPooledObject()
{
    for (int i=0; i<pooledObjects.Count; i++) 
    {
                    if (!pooledObjects *.activeInHierarchy)* 

{
return pooledObjects ;
}
}
if (willGrow) {
GameObject obj = (GameObject)Instantiate (PooledObject);
pooledObjects.Add (obj);
return obj;
} else {
return null;
}
}}

Player Health

using UnityEngine;
using System.Collections;

public class PlayerHealth : MonoBehaviour {

    public int maxHealth;
    public int curHealth;
    //public int curStamina;
    //public int maxStamina;

    public float healthBarLength;
    //public float staminaBarLength;

    // Use this for initialization
    void Start () {
        healthBarLength = Screen.width / 6;
        //staminaBarLength = Screen.width / 6;
    }
    
    // Update is called once per frame
    void Update () {
        AdjustCurrentHealth (0);
        if (curHealth < 1) {
                        Destroy (gameObject);
                }
        //AdjustCurrentStamina (0);
    }

    void OnGUI ()
    {
        GUI.color = Color.red;
        GUI.Box (new Rect (40, 40, healthBarLength, 20), curHealth + "/" + maxHealth);
        //GUI.Box (new Rect (40, 60, staminaBarLength, 20), curStamina + "/" + maxStamina);
    }

    //void OnGUI()
    //{
    ///    GUI.color=Color.green
        //GUI.Box (new Rect (40, 60, staminaBarLength, 20), curStamina + "/" + maxStamina);
    //    }
    public void AdjustCurrentHealth(int adj)
    {
        curHealth += adj;

        if (curHealth < 0)
                        curHealth = 0;

        if (curHealth > maxHealth)
                        curHealth = maxHealth;
        if (maxHealth < 1)
                        maxHealth = 1;

        healthBarLength = (Screen.width / 6) * (curHealth / (float)maxHealth);
        }

    void OnCollisionEnter(Collision col)
    {
        if (col.gameObject.tag == "Bullet") {
            curHealth -= 20;
            //Destroy (col.rigidbody);
        }}}



//    public void AdjustCurrentStamina(int adJ)
//    {
//        curStamina += adJ;
//        
//        if (curStamina < 0)
//            curStamina = 0;
//        
//        if (curStamina > maxStamina)
//            curStamina = maxStamina;
//        if (maxStamina < 1)
//            maxStamina = 1;
//        
//        staminaBarLength = (Screen.width / 6) * (curStamina / (float)maxStamina);
//    }


    //void

Mover (moves the bullet)

using UnityEngine;
using System.Collections;

public class mover : MonoBehaviour {
    public float speed;

    // Use this for initialization
    void Start () {
        rigidbody.velocity = transform.up* speed;;
    }

    void OnEnable()
    {
        Invoke ("Destroy", 2f);
    }

    void Destroy ()
    {
        gameObject.SetActive (false);
        }
//    void OnDisable()
//    {
//        CancelInvoke ();
//        }

    }