Move camera to game object in scene?

i just need to move the main camera on the X and Y in my scene to focus on a different thing
im in 2d mode so Z really doesn’t matter here.

ive searched and i cant seem to get it to work. whats the easiest way?

just need something like “move camera to x,y”

thanks

You’ll need a Lerp for that. To go from 1 position to another. Unity has a great video explaining how it works: http://unity3d.com/learn/tutorials/modules/beginner/scripting/lerp

Please comment if you need any help

void Update()
{
Camera.main.transform.position = new Vector3 (transform.position.x,transform.position.y,Camera.main.transform.position.z);

}

i guess? :slight_smile: