How to change varuables of an instances script when instantiateing.

First of all, sorry if I’m beeing unclear, I’m still new to all this.

I want to set HomingRoundScript.targeted (transform) to my targeted (transform).

what I’m trying to do is basicly this (JavaScript):

		var instance = Instantiate (projectileType[currentAmmo],muzzlePos.position,muzzlePos.rotation);
		instance.GetComponent(HomingRoundScript).targeted = targeted;

but I can’t get it to work in C#:

	void Fire(){
		GameObject instance = Instantiate (projectileType[currentAmmo], muzzlePos.position, muzzlePos.rotation);
		instance.gameObject.GetComponent<HomingRoundScript> () .targeted = targeted;
		
	}

Again… I’m new at all this so small words is apprecitated

void Fire(){
GameObject instance = Instantiate (projectileType[currentAmmo], muzzlePos.position, muzzlePos.rotation) as GameObject;
instance.GetComponent () .targeted = targeted;
}

Just added ‘as GameObject’ at the end of your Instantiate statement (for type casting) and removed gameObject after instance from next line since instance itself is a game object.