I have a camera class, that is suppose to chase my player, which works, but its really really slow. It only has this line of code, which makes sense to me, player moves, camera moves. Any idea of why my game runs slower.

void Update()
    transform.position= new Vector3(player.transform.position.x, player.transform.position.y, -10);
  • 1
    \$\begingroup\$ "Slow" as in low framerate? Or delayed reaction to player movement? Or what? If it's framerate, I suspect the camera has little/nothing to do with it. If it's a delayed reaction, Spooks is right about using LateUpdate(). \$\endgroup\$ Commented Nov 3, 2011 at 3:43

3 Answers 3


I think the reason this is happening is because you are updating the player and the camera in a random order, which may make the camera move first, which wouldn't cause it to move at all, then the player would move, and the next update the camera has to catch up to the player, which causes a lag like appearance.

Using LateUpdate() on your camera instead of Update() should fix this problem, as you want to edit the movement of the camera after the player has moved first (creating a chasing camera)

Take a look at the Update Order

  • \$\begingroup\$ As far as I've seen, the ordering is non-deterministic, but it isn't going to do something like alternate ever frame. But putting it in LateUpdate is good advice regardless to ensure update order (or by using the new update order stuff in 3.5 to explicitly set it). \$\endgroup\$
    – Tetrad
    Commented Nov 3, 2011 at 2:59
  • \$\begingroup\$ you are probably right with it not alternating every frame. But you can't pick which one updates first, which is needed, in order to have a chasing camera. I haven't looked into the new order stuff in 3.5 (haven't got an update yet for it) but i'll look into that as well \$\endgroup\$
    – Spooks
    Commented Nov 3, 2011 at 3:31

When you say "really really slow", what exactly do you mean? Are you running this on a mobile device? On the PC it shouldn't matter. Are you going from like 1000fps to 750fps or something?

Is this showing up in the built-in profiler?

Regardless, one speed optimization you can try, if all else fails, is by caching off your transforms.

The built in unity .transform property is quite literally doing return GetComponent( typeof( Transform ) ) (or its equivalent). Storing off a local variable to both your transform and the player's transform will prevent that lookup every time you call it.

  • \$\begingroup\$ running on pc, my framerate was okay(100-115fps), but it just very laggy. LateUpdate fixed this \$\endgroup\$ Commented Nov 3, 2011 at 16:36


  1. You can't choose obj file because Unity will have a very slow camera and etc. Convert them for example with iClone 3DXchange v7.01 Pipeline to fbx only!
  2. You must occlusion your camera!
  3. Chage size of your texture with Advanced JPEG Compressor.
  4. Change your build setting like my picture. alt text

Your camera will be high speed.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .