Determine player rotation

I’m trying to get the amount the player has rotated along the XZ plane and disregard the Y axis. The code I’m using now takes all three axes into account. Anyone have any ideas?

void Start()
{
    player = GameObject.FindGameObjectWithTag("MainCamera");
    playerGhost = new GameObject();
    playerGhost.transform.rotation = player.transform.rotation;
}

void Update()
{
    if (Vector3.Angle(playerGhost.transform.forward, 
            player.transform.forward) >= 45)
    {
        //DO STUFF
        playerGhost.transform.rotation = player.transform.rotation;
    }
}

The easiest solution to this problem is to remove the ‘y’ component from the two vectors you want to compare:

Vector3 a = playerGhost.transform.forward;
Vector3 b = player.transform.forward;
a.y = 0.0f;
b.y = 0.0f;

if (Vector3.Angle(a,b) >= 45.0f)
{
        //DO STUFF
        playerGhost.transform.rotation = player.transform.rotation;
}