Hello everyone, I’m trying to somehow understand what’s going on my code. It’s supposed to make a circle increase in size(localScale) after it’s created. It has a start and ending size, the lerp is inside a coroutine which starts only ONCE. If I debug the Vector3.Lerp it returns the same (0.7,0.7,0.7) every frame while the IEnumerator coroutine is working. Please if you can point out the error I’d be really glad. The circle gets to the ending size after the coroutine has finished, but there’s no transition visible
This snippet of code brings sets the parameters of the function EnlargeCircle
Vector3 initialSize = new Vector3(0.0f,0.0f,0.0f);
Vector3 endingSize = new Vector3(spread*2.0f,spread*2.0f,spread*2.0f);
StartCoroutine(EnlargeCircle(initialSize,endingSize));
Here is the function.That starts only once.
IEnumerator EnlargeCircle(Vector3 initialSize,Vector3 endingSize)
{
float t = 0;
while(t < 5)
{
t += Time.deltaTime;
circle.localScale = Vector3.Lerp (initialSize, endingSize, Time.deltaTime);
yield return null;
}
circle.localScale = endingSize;
}