hii, im trying to learn to work with unity . while writing the code im constantaly getting the above error . here is the code…
using UnityEngine;
using System.Collections;
public class cameratracksPlayer : MonoBehaviour {
Transform Player;
float offsetX;
Vector3 pos ;
public GameObject player_go;
Vector3 tp;
// Use this for initialization
void Start () {
player_go = GameObject.FindGameObjectsWithTag ("Player")[0];
if (player_go == null) {
Debug.LogError ("Coudn't find an object with tag 'Player'!");
return;
}
Player = player_go.transform;
offsetX = transform.position.x - Player.position.x;
}
void Update () {
if(Player != null)
{
tp = transform.position;
pos = tp;
pos.x = Player.position.x + offsetX;
tp = pos.x;
}
i do understand tht pos.x returns a float value but i dont understand hw to proceed ,plz help me out.