hello, this is the script that I did.
void Start ()
{
posFinale = new Vector3(Random.Range (-17.0f,18.0f),Random.Range (-10.0f,11.0f),0);
}
void Update ()
{
transform.Translate ((posFinale - transform.position)* speed * Time.deltaTime);
if ((transform.position == posFinale) && !(fatto))
{
fatto = true;
Instantiate(add,transform.position, Quaternion.identity);
Destroy (gameObject);
}
Debug.Log (posFinale);
}
But I have a problem, when it comes to the location is not that precise so do not spawn the enemy.
I also tried with vector3.lerp but does the exact same thing
Is there another way to do this?