How to make a camera change position using Vector3.lerp over 2 seconds?
Hi,
I am trying to make my camera "slide" to be above a tile in my game when you click a button. The point is to show the player where the action they are doing is taking place. I am using a coroutine with a lerp inside it to make it "slide" over to the position instead of just warp there. I have tried lots of different things and no matter what I do it just warps to the position. The coroutine script looks like this.
Was going to delete because I figured it out but thought my bug might be useful for other beginners to know about.
The reason why my code wasn't working is because I was destroying the object that called this script just after calling the coroutine. Put the coroutine on the camera and called a function on the camera that calls the coroutine ins$$anonymous$$d and know it works. Also made some $$anonymous$$or adjustments to the coroutine.
However, nice to know that if you destroy the object that called the coroutine the coroutine will be destroyed as well.
Cheers, Feral Pug