AutoCam script from Simple Assets package stutters heavily

I’m having stuttering issues in editor using the AutoCam script from the SimpleAssets package. I fixed it for now by parenting the camera to my moving object directly but I’m losing all the nice smooth follow effects of the script.
I am moving my object using a coroutine and yielding at every frame, therefore I guess that the AutoCam script should use Update to follow the object correctly (I tried to use FixedUpdate as well but the stuttering remains). I tried to also call the FollowTarget method of AutoCam.cs from inside my coroutine in order to have it executed in sync but it doesn’t work. Any idea about what the problem can be?

Hello!

I don’t know the exact source of your problem, but maybe one of these will help you:

  1. move the object in the Update()
  2. move the camera in the FixedUpdate()
  3. use the Vector3.lerp on the camera position (camera.transform.position = vector3.lerp(camera.transform.position, object.position,x) “the x is s number between 0 and 1 , it represents the smoothing”)

the AutoCam script provided by Unity does that actually, it allows you to tell the camera to follow an object using LateUpdate. The problem persists though. As I said I move my object (the one that the camera has to follow) inside a coroutine. I use a while loop and yield return 0 after every move, which means (if I’m correct) that my object moves at every frame. Either way I don’t understand why the camera stutters in my case.

I noticed that in the Unity example in the SimpleAssets package they move the objects using physics, and there the camera follows the object without stutter. In my case I move an object inside a coroutine but this should not matter right?