I have absolutely no idea if this makes sense, but I have a coroutine in which the transform.position, transform.rotation, and transform.localScale are all being moved towards and rotated towards their own specific value until the position of the object reaches it’s value. What I am asking is how to make everything finish at the exact time the transform.position reaches it’s value/position. Here is my current code to make it slightly clearer:
private IEnumerator IMoveTransform(Vector3 position, Quaternion rotation, Vector3 scale, float speed)
{
while (transform.localPosition != position)
{
transform.localPosition = Vector3.MoveTowards(transform.localPosition, position, speed * Time.deltaTime);
transform.localScale = Vector3.MoveTowards(transform.localScale, scale, speed * Time.deltaTime);
transform.localRotation = Quaternion.RotateTowards(transform.localRotation, rotation, speed * Time.deltaTime);
yield return new WaitForEndOfFrame();
}
transform.localPosition = position;
transform.localRotation = rotation;
transform.localScale = scale;
}