Converting an object to a GameObject

When it comes to unity’s casting with Object to GameObject, it continues to elude me. For example:

//if the phase isn't done, run its procedures
			if(!phaseList*.GetPhaseDone())*
  •  	{*
    

_ phaseList*.Run();_
_ GameObject nextSpawn = phaseList.NextSpawnObject();*_

* if(nextSpawn)*
* {*
* GameObject newSpawn = Instantiate((GameObject)nextSpawn,new Vector3(0,-20,0),Quaternion.identity);*
* }*
* }*
NextSpawnObject returns a GameObject prefab as its definition. The variable is a GameObject and everything within the function. However, I continue to get an error for trying to cast it with the Instantiate function. It won’t work without the cast, either. What could be wrong?

Instantiate returns an Object

You need to cast it to GameObject

eg

 if(nextSpawn)
 {
      GameObject newSpawn = 
            (GameObject)Instantiate((GameObject)nextSpawn,
              new Vector3(0,-20,0),Quaternion.identity);
  }

OR

if(nextSpawn)
{
      GameObject newSpawn = 
         Instantiate((GameObject)nextSpawn,
              new Vector3(0,-20,0), Quaternion.identity) as GameObject;
}

When in doubt, always read the docs…