Is there a way to get the transform of an Object (not GameObject)

I am instantiating an object, and I need the instantiated object’s transform. Problem is, the instantiated object is an Object, not a GameObject - so I cant seem to access its transform. So I tried to type cast it using player = (GameObject)Instantiate… but it says its an invalid cast.

How can I get the transform of my instantiated object??’

Thanks very much.

This is my spawn script:

	private GameObject player; // reference to instantiated player
	private Transform playersTransform;
	private Camera camera; //referemce to camera.
	private CameraControllercs target;

void SpawnBlueTeamPlayer()						//find BLUE spawn points and put them into an array.
		blueSpawnPoints = GameObject.FindGameObjectsWithTag("SpawnBlueTeam");
														//randomly select one of the spawn points
		GameObject randomBlueSpawn = blueSpawnPoints[Random.Range(0, blueSpawnPoints.Length)];
														//Instantiate player at the randomly selected point.
		player = (GameObject)Network.Instantiate(blueTeamPlayer, randomBlueSpawn.transform.position, randomBlueSpawn.transform.rotation, blueTeamGroup);
		playersTransform = player.transform;
		camera = Camera.main;
		target = camera.GetComponent<CameraControllercs>(); = player.transform;

Target goes to my camera script which sets the target of my camera.

Depends on what “blueTeamPlayer” actually is. Lets assume it is some sort of MonoBehaviour. Then your code would be:

MonoBehaviour playerBehaviour = (MonoBehaviour) Network.Instantiate(blueTeamPlayer, randomBlueSpawn.transform.position, randomBlueSpawn.transform.rotation, blueTeamGroup);
player = playerBehaviour.gameObject;

Think of Instantiate as a smart ‘Clone()’ method. Therefore Instantiate(…) always returns the same object type as the prefab you pass in. The returned object will be a deep-clone, and will come with a new game-object.