I’m working on a platformer and I’m really new to unity. I know that you could drag the camera under the player and make it a child however my object is a ball that rolls so it rotates along with the player. I’m looking for a way to track just the X and Y of the player. I’ve tried multiple other threads and websites however none of them worked. I am using Unity 5 if that makes a difference!
easiest way would be to set this code in update of camera
Update()
{
transform.position = new Vector3(player.transform.position.x,player.transform.position.y, -10) //change 10 with desired distance from player
}
also dont forget to include initialization of player variable so before all actions set
public GameObject player;
and then drag player object in editor from hierarchy to camera variable of player