Vector3.Slerp not working

Hello,
I’m trying to write a script which creates a platform and over short period of time moves the platform into position above. But I can get it working properly: the platform instantiates only on start position and doesn’t move at all. Thanks for the help.

using UnityEngine;
using System.Collections;

public class GroundCreator : MonoBehaviour {

public GameObject[] ground;
public Transform startpoint;
public Transform endpoint;

public bool detector;

public float time = 1f;

void Start()
{
	detector = false;
}

void OnTriggerEnter2D (Collider2D other)
{
	if(other.tag == "Player")
	{
		detector = true;
	}
}

void Update()
{
	if(detector == true)
	{
		int i = Random.Range(0, ground.Length);
		GameObject groundInstance = Instantiate(ground*, startpoint.position, startpoint.rotation) as GameObject;*

_ groundInstance.transform.position = Vector3.Slerp(startpoint.position, endpoint.position, time * Time.deltaTime);_

  •   	Destroy(gameObject);*
    
  •   }*
    
  • }*
    }

Don’t use Time.DeltaTime as parameter to Slerp. If you want to animate the position for a given time, create one variable for defining the seconds you want to animate, and a second variable keeping track of the fraction of that you already animated. Then use a third variable to map the second variable to the interval [0…1] and pass that as a parameter to Slerp.

Lerp and Slerp are attended functions, i.e they require constant attention and must be called every frame to work properly.

 groundInstance.transform.position = Vector3.Slerp(startpoint.position, endpoint.position, time * Time.deltaTime);
Destroy(gameObject);

You perform one step of Slerp and then destroy the object which handles it. Place your Slerp in a script on the Instantiated gameObject and use GetComponent to trigger the Slerp, so destroying your creator object won’t prevent the Slerp being performed.