Rotate player model on Y axis with camera.

I try to make my player model rotate with camera movement but only on Y axis like in almost every other game. The thing is I can only rotate it along all axis because if I try to assign camera Y rotation to player Y rotation, Unity throws out errors about float/quaterion conversion. How to do it?

How does it looks like

public class playerRotator : MonoBehaviour {
	private GameObject kamera, gracz;
	private Quaternion rotacja;
	// Use this for initialization
	void Start () {
		kamera = GameObject.Find ("CameraTripod");
		gracz = GameObject.Find ("bohater");
	}
	
	// Update is called once per frame
	void Update () {
		rotacja = kamera.transform.rotation;
		Debug.Log (rotacja.eulerAngles);
		gracz.transform.rotation = rotacja;
	}
}

Try this:

void Update ()
{
    rotacja = kamera.transform.rotation;
    Debug.Log (rotacja.eulerAngles);
    gracz.transform.rotation.SetEulerRotation(gracz.transform.rotation.eulerAngles.x, rotacja.eulerAngles.y, gracz.transform.rotation.eulerAngles.z);
}

I recommend you using localRotation instead of the global one.
Check also Transform.LookAt and Quaternion.SetLookRotation, you might find them handy.

@Gracek
Not the prettiest, but this should do it for you I think?

using UnityEngine;
using System.Collections;

public class playerRotator : MonoBehaviour {

	public GameObject kamera;  // Assign the object that spins in x,y,z
	public Quaternion rotacja = Quaternion.identity;
	
	void LateUpdate () {
		rotacja.eulerAngles = new Vector3 (transform.rotation.eulerAngles.x, kamera.transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.x);
		transform.rotation = rotacja;
	}
}

You could try use the simple mouse rotator that comes with Unity and attach it to whatever bone you are using.