2D Tutorial - Camera reorients itself on startup, no focus

Hello, I am new to the boards. I have a few years (2001ish) experience doing game development with other platforms such as BYOND and Gamemaker, but now that Unity is free I'm definitely interested in checking it out.

I picked up the 2D tutorial because I think it will be easiest to work with 2 dimensions in a 3D environment, since all my other work has been 2D.

But on to my problem! I might be an idiot (you tell me), but essentially I have followed the 2D Tutorial up through page 20, which is where I add and configure the camera.

When I run the game, the camera briefly (0.3~ seconds) focuses on whatever it was positioned at in the scene window, then immediately warps to some other position. If I watch it in the inspector, here's what happens:

Starts at -10,80,-15 then warps to 8,15,-15 (with some decimals) and then slowly climbs to 8,51,-15, as if it's deaccelerating after focusing on something.

I gave the Main Camera the CameraFocus and CameraScrolling scripts, I set my Target to "Character (Lerpz)" with the vector icon (not the cube icon), and I set the Target Button Name to "Player".

Every object in the hierachy has a Z index of 0 (except the camera, which is -15 and seems to correspond with the "distance" variable of the CameraScrolling script, too.

Lerpz is placed properly, and he actually falls onto the platform (I can see in the inspector) and I can make him move around, but the entire time the camera is just looking off into the skybox somewhere.

Any ideas what I screwed up? =D

I originally posted this on the forums before I realized this is the better place for answers: http://forum.unity3d.com/viewtopic.php?t=39425

I had this problem too.

The cause seemed to be that the CameraFocus script is picking up the wrong target; there's both the prefab named 'Character (Lerpz)' as well as the GameEntity with that name. Choosing the correct entry (the game entity) from the popup in the Targets array doesn't seem to work, because the script won't find the correct target when it runs.

To fix the problem: Rename the character to something different (Lerpz, George, Asdf) and then change the target element (Element 0, in the Camera Focus script pane) to point to the renamed entity. The camera will then work proper.

I haven't played with that tutorial specifically, but I would guess: the values in the transform attached to the Main Camera are the starting position; the scrolling / accelerating behaviors are controlled in the CameraScrolling script to smoothly adjust the position, and the transform of the Target is going to be the look-at location for the camera.

If you want the camera to not warp around on start up, you need to adjust the camera position so that it is approximately where it should start (which, according to your post, is where the camera ends up converging : 8,51,-15; I would guess that Lerpz' starting position is near 8, 51, 0?

As to why it isn't looking at anything, I would say try modifying the z position from -15 to +15; or adjusting the rotation of the camera so that it is pointing down the z axis (which would be a 90 degree rotation around the y axis, I think).

You can adjust things while the game is running by changing variables in the inspector, but remember that those changes will revert as soon as you stop the game, so once you find the right values you have to re-apply them.