Code Working in one place but not the Other

this piece of code instantiates the bullet, and then i’m trying to check if it exisists so i can do stuff to it

i am printing the instantiated game object to see if it exits, the first code prints the game object

the second piece of code prints null even though the bullet has been added in the game

//piece of code attached to the player

void Update () {
	if(Input.GetButton("Fire1") && Time.time > nextFire && Screen.lockCursor == true)
		{	
			nextFire = Time.time + fireRate;
			GameObject go = Instantiate(bulletPrefab, spawnPoint.position, spawnPoint.rotation) as GameObject;
			print (go); //<-----------------------------------
			BulletScript bulletScript= go.GetComponent<BulletScript>();
			bulletScript.myOriginator= myTransform;
		}
	}

second piece of code and it is attached to the enemy

if (bulletTimer > 0) {
				bulletTimer -= Time.deltaTime;
			} else {
				GameObject go = Instantiate (enemyBulletPrefab, bulletSpawnPoint.position, 
				bulletSpawnPoint.rotation)as GameObject;
				print (go);//<------------------------------
				EnemyBulletScriptS bulletScript= go.GetComponent<EnemyBulletScriptS>();
				bulletScript.myOriginator= myTransform;
				bulletTimer = 2;
			}

A quick guess:

This is possibly because you haven’t dragged and dropped the added prefab onto the enemyBulletPrefab public variable in the second case. I.e., even if you did add the prefab, you need to set the variable in the editor to point to it, or it won’t know what to instantiate, so it returns null.

Found the problem, when declaring it, it has to be a GameObject not Transform