Controlling gameObject inside another gameObject script

My players instantiates bullet that track’s his position in update(bullet follows player according to its position).
The problem is that bullets position does not change and I don’t wanna create another script on bullet just for tracking.


public class player : MonoBehaviour {

public GameObject Bullet;
Vector3 startPosition,currentPosition;

// Use this for initialization
void Start () {
	startPosition = new Vector3 (gameObject.transform.position.x, gameObject.transform.position.y, 0);
	Instantiate (Bullet, startPosition, Quaternion.identity);


}

// Update is called once per frame
void Update () {

	currentPosition = new Vector3 (gameObject.transform.position.x, gameObject.transform.position.y, 0);
	Bullet.transform.position = currentPosition;

}

Thanks in advance.

If what you want is to have Bullet following the player around, does it work if you assign the instantiated bullet to a variable and use that to update it’s position, doing something like this?

public class player : MonoBehaviour {
 private GameObject instantiatedBullet;
 public GameObject Bullet;
 Vector3 startPosition,currentPosition;
 
 // Use this for initialization
 void Start () {
     startPosition = new Vector3 (gameObject.transform.position.x, gameObject.transform.position.y, 0);
     instantiatedBullet = Instantiate (Bullet, startPosition, Quaternion.identity) as GameObject;
 }
 
 // Update is called once per frame
 void Update () {
     currentPosition = new Vector3 (gameObject.transform.position.x, gameObject.transform.position.y, 0);
     instantiatedBullet.transform.position = currentPosition;
 }