Null Reference Exception on instantiated objects script.

I am instantiating an object over a Network using an RPC. The object instantiates fine but if I try accessing the script when it is instantiated I get a null reference exception on the client and server.

This is the RPC.

// Instantiate a Arrow projectile across the network.
	[RPC]
	void SpawnProjectileArrow(Vector3 position, Quaternion rotation) {

		GameObject arrow = Instantiate(projectileArrowPrefab, position, rotation) as GameObject;
		arrowProjectileScript aScript = arrow.GetComponent<arrowProjectileScript>();
		
	}

The “arrowProjectileScript” is attached to the projectileArrowPrefab.

Any Ideas on what is causing this?

Thanks - Matt

Dam, found it. Needed to be a public GameObject not a Transform. Whoops.

public GameObject arrowProjectileScript;

Thanks for the help guys.

Regards - Matt