Object pool with "Null Reference Exception" problem

Hello,
I am trying to use an object pool for my pipes that will be coming into screen instead of instantiating them for better performance. I found a tutorial on youtube about object pools and changed the syntax to javaScript while changing everything to my own variables. The problem I am having is I get a “Null Reference Exception” because of these lines in my “SteamPipePool” Script:

   steamPipes*.GetComponent("SteamPipeMove");*

steamPipeMove.Activate();
I think the Null reference is because I haven’t been able to correctly setup my GetComponent to grab the script from each game object instantiated, but after trying multiple things I can’t get it to work.
I have two scripts(one on the pipe Prefab and one on the Object pool manager in my scene). Currently I have my Update function in the “SteamPipePool” script enabled for testing with the mouse click.
If anyone could point me in the right direction I would be very grateful.

This is the script on my pipe prefab named “SteamPipeMove”:
var pipeLife : float = 3.0;
var pipeSpeed : float = 10.0;
private var timeToReturn : float = 0.0;

function Start()
{

  • timeToReturn = Time.time + pipeLife;*
    }

function Update ()
{

  • PipeMove();*
  • CountDown();*
    }

function PipeMove ()
{
_ transform.Translate(-pipeSpeed * Time.deltaTime, 0,0);_
}

function Activate ()
{

  • timeToReturn = Time.time + pipeLife;*
  • transform.position = Vector3(11, 1, 0);*
    }

function Deactivate ()
{

  • gameObject.SetActive(false);*
    }

function CountDown ()
{

  • if(timeToReturn < Time.time)*
  • {*
  •  Debug.Log("Hit");*
    
  •  Deactivate();*
    
  • }*
    }
    And this is the script I have on my Object Pool Manager named “SteamPipePool”:
    var moveTimeMin : float = 1.0;
    var moveTimeMax : float = 2.3;
    var pipe : Transform;
    var steamPipes : GameObject[] = null;
    var numberOfPipes : int = 6;
    private var steamPipeMove : SteamPipeMove;
    private var i : int;

function Start()
{

  • steamPipes = new GameObject[numberOfPipes];*
  • InstantiatePipes();*
    }

function Update ()
{

  • //To test the whole thing*
  • if(Input.GetMouseButton(0) == true)*
  • {*
  •  ActivatePipes();*
    
  • }*
    }

function InstantiatePipes()
{

  • for( i = 0; i < numberOfPipes; i++)*
  • {*
    _ steamPipes = Instantiate(pipe.gameObject,Vector3(13,1,0),Quaternion.identity)as GameObject;_
    _ steamPipes*.SetActive(false);
    }
    }*_

function ActivatePipes()
{
* for( i = 0; i < numberOfPipes; i++)*
* {*
_ if(steamPipes*.activeInHierarchy == false)
{
steamPipes.SetActive(true);
steamPipes.GetComponent(“SteamPipeMove”);
steamPipeMove.Activate();
return;*_

* }*
* }*
}
Eventually I want to alternate different pipes randomly instead of just one pipe but I think I need to get this working first.
Thanks for the help!

try this on line 40:

steamPipeMove = steamPipes*.GetComponent("SteamPipeMove");*