How to move my prefab towards a target?
I have a missile as a prefab and i want it to move towards enemy ship which is the target.
I have written a script to move the prefab
public Transform target
Void Start()
{
target = GameObject.find(“Enemy”).transform;
}
void Update ()
{
transform.position = Vector3.MoveTowards(transform.position, target.transform.position, 1.0f);
}
but when i play it says NullReferenceException: Object reference not set to an instance of an object