Scripting Movement Fails for Instantiated Prefab

Hey everyone,

I am trying to instantiate a series of objects that move along a path (z-axis), then are destoryed at the end of the path. I have cobbled together all the elements, but am having trouble with the movement portion once the 2nd object generates.

Here is my movement Script (that works on the first prefab) :

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ReefObstacleMovement : MonoBehaviour {

		public Transform target;
		public float speed;
		void Update() {
			float step = speed * Time.deltaTime;
			transform.position = Vector3.MoveTowards(transform.position, target.position, step);
		}
	}

However, when I try to add a 'Target" to the prefab itself, it will not let me add a gameobject as a target in the inspector.

As an example, here is the 1st created pre-fab that is present when the scene starts that works ( notice I have “ReefMovementTarget” in the “Target” input field:

89327-screen-shot-2017-03-04-at-13344-pm.png

In contrast, here is the prefab itself, which is supposed to instantiate and move, but it only instantiates and does not move. I also cannot drag my game object “ReefMovementTarget” into the target input field, which is why I am guessing it is not moving:

89328-screen-shot-2017-03-04-at-13325-pm.png

Any help, advice, or workaround on why I cannot set a “target” for the prefab here would be ideal.

Thank you!

EDIT:
Everything I have been researching has lead back to this link for Vector3 Move Towards, but with a public Transform, as opposed to a public GameObject, the prefab is not registering the “movement” script.

I would think this would be a simple case of replacing “transform” with “GameObject” but apparently it is more complex then that. Any advice here is appreciated.

Try casting the variable as a GameObject, instead of a Transform.

Destroy Script as well:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DestroyScript : MonoBehaviour {

	public float destroyTime = 3.0f;


	void Start () {
		Destroy (gameObject, destroyTime);
	}
}