How do I reference GameObjects made with new GameObject?

I’m playing around with generating my object pool by using a function that takes sprite prefabs and GameObject variables to add the necessary components and form the objects. I’ve had success with both sprites and Texture2Ds (textures to adjust pivot points) but when its time for me to reference the objects in the pool i always get a null reference. The references worked fine before it was a function but once I converted it my GameObject references were all null. What am I doing wrong?

void Builder (GameObject thingy, Sprite toon, bool extend) {
//thingy = new GameObject (“shitBrick”);
GameObject stuff = new GameObject (;
thingy = stuff.transform.gameObject;
// = + " " +;
stuff.tag = “Brick”;
stuff.transform.position = nowhere;
SpriteRenderer renderer = stuff.AddComponent();
renderer.sprite = toon;
Color ghostly = renderer.color;
ghostly.a = 0.3f;
stuff.GetComponent().color = ghostly;
stuff.SetActive (false);

this is the function. every stuff variable was a thingy but I tried splitting it up to get the reference. uuuh, it looked like this before tampering to this point…

void Builder (Texture2D toon) {
GameObject thingy = new GameObject (“shitBrick”); = + " " +;
thingy.tag = “Brick”;
thingy.transform.position = nowhere;
Sprite spryte = Sprite.Create (toon, new Rect (0.0f, 0.0f, pic.width, pic.height), new Vector2 (0.5f, 1.0f), 100.0f);
SpriteRenderer renderer = thingy.AddComponent();
renderer.sprite = spryte;
GhostItem panamgargleblaster = new GhostItem(thingy, toon, 0, renderer.bounds.size.x);
Color ghostly = renderer.color;
ghostly.a = 0.3f;
thingy.GetComponent().color = ghostly;
thingy.SetActive (true);

these were pulled from operational code I had working just fine but as its essentially the same code repeating 6 times right now and will be at least 24 times once it works I felt it obviously needed to be a function (obvious to a not programmer that is).

//~~ Sooo turns out the answer was use a function with a return; changing it from

void Builder (GameObject thingy, Sprite toon, bool extend) {

//~~ to …

public GameObject Builder (GameObject thingy, Sprite toon, bool extend) {

//~~ with a return of…

return thingy;

//~~ and when calling the function typing it as…

bkGhost = Builder (bkGhost, brick, false);

//~~ instead of…

Builder (bkGhost, brick, false);