Camera objects rotation won't change from 45 deg.

Hi, I trying to instantiate a camera (don’t know if this is right terminology), but everything I set the coords for the x-axis rotation, it sets the x angle to 45 degrees automatically. Even though I set in my script for the x parameter to point at 22.5 degrees and used a variable set at that those degrees.


using UnityEngine;
using System.Collections;

public class GameMaster : MonoBehaviour {
    public GameObject playerCharacter;
    public Camera mainCamera;

    public float zOffset;
    public float yOffset;
    public float xRotOffset;

    private GameObject _pc;

	// Use this for initialization
	void Start () {
        _pc = Instantiate(playerCharacter,, Quaternion.identity) as GameObject;

        zOffset = -2.5f;
        yOffset = 2.5f;
        xRotOffset = 22.5f;

        mainCamera.transform.position = new Vector3(_pc.transform.position.x, _pc.transform.position.y + yOffset, _pc.transform.position.z + zOffset);
        mainCamera.transform.Rotate(22.5f, 0, 0);
	// Update is called once per frame
	void Update () {

Can you check that camera’s transform (in the editor) has identity (0, 0, 0) rotation? Your code doesn’t set the rotation to (22.5f, 0, 0), rather it rotates camera’s existing transform. So if it had some non-identity rotation assigned to it prior to this call, it would be composited with the (22.5f, 0, 0) rotation.

If you want to override whatever rotation camera had, you can use the following code instead:

transform.rotation = Quaternion.Euler (22.5f, 0, 0);

Perfect, I had to replace the transform.Rotate with your line of code and worked perfectly.