Is there a way to slowly resize a line renderer?

I want to resize my line renderer so you can actually see it resizing. With the default resize (or rather setting of the positions), it instantly resizes.

Any way you can use time.DeltaTime or something similar?

PS. I'm using almost the same coding as mention in the Scripting Reference

So you want to 'slowly' go from one value (sizeA) to an other (sizeB). This is called linear interpolation - acronym-ed lerping.

Unity has a build in Lerp function for many values. If you want to go from one integer to an other in a set time it looks like you should use Mathf.Lerp

Goodluck.


"But how can I combine the Mathf.Lerp with a raycast hit.distance? The line resizes to the hit.distance "

That means sizeB is hit.distance.

var sizeB = hit.distance;

use this as the targetsize in the lerp function.