camera does not have definition for field of view

317 views Asked by At

unity console shows me the same error everytime "camera does not have definition for field of view" i renamed field of view many time i wrote it with all of types but nothing happened i tried following tutorials but i got the same error always i tried to change the cinemachine FOV but i got also an error plz help.....

this is my code :

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Animations.Rigging;
using Cinemachine;
public class Movements : MonoBehaviour
{
    public GameObject cinemachine;

public Transform Cameratarget;
    public float turnSpeed = 15;
   
    public Camera MainCamera;
    public Animator anim;
    public Camera myCam;
    public Rig aimLayer;
    public float aimDuration = 0.3f;
    public float speed = 14f;
    public float elResitas  = -14f; 
   [SerializeField] Transform ZoomTarget;
    Cinemachine.CinemachineFreeLook elResitas2;
  
    // Start is called before the first frame update
    void Start()
    {
      elResitas2 = cinemachine.GetComponent<CinemachineFreeLook>();
      MainCamera = Camera.main;
        Cursor.visible = false;
        Cursor.lockState = CursorLockMode.Locked;
        anim = GetComponent<Animator>();
       myCam = Camera.main;
    }

    // Update is called once per frame
   void FixedUpdate()
{
    
    if (Input.GetKey(KeyCode.Z))
    {
        anim.SetFloat("MoveX",0.17f);
      transform.Translate(new Vector3(0,0,speed)*Time.deltaTime);
      float yawCamera = MainCamera.transform.rotation.eulerAngles.y;
        transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.Euler(0, yawCamera, 0), turnSpeed * Time.fixedDeltaTime);
      
    }
    else if (Input.GetKey(KeyCode.S))
    {
        anim.SetFloat("MoveX",-0.166f);
        transform.Translate(new Vector3(0,0,elResitas)*Time.deltaTime);
        float yawCamera = MainCamera.transform.rotation.eulerAngles.y;
        transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.Euler(0, yawCamera, 0), turnSpeed * Time.fixedDeltaTime);
    }
    else
    {
        // Only reached if neither Z nor S is pressed!
        anim.SetFloat("MoveX", 0);
    }
    if (Input.GetKey(KeyCode.D))
    {
         anim.SetFloat("MoveZ",0.208f);
      transform.Translate(new Vector3(speed,0,0)*Time.deltaTime);
    }
    else if (Input.GetKey(KeyCode.Q))
    {
        anim.SetFloat("MoveZ",-0.2f);
        transform.Translate(new Vector3(elResitas,0,0)*Time.deltaTime);
    }
    else
    {
        // Only reached if neither Q nor D is pressed!
        anim.SetFloat("MoveZ", 0);
    }
    if (Input.GetKey(KeyCode.Mouse1))
    {
      elResitas2.m_LookAt = ZoomTarget.transform;
 


        speed = 6;
        elResitas = -6;
        aimLayer.weight += Time.deltaTime / aimDuration;
        float yawCamera = MainCamera.transform.rotation.eulerAngles.y;
        transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.Euler(0, yawCamera, 0), turnSpeed * Time.fixedDeltaTime);
    }
     else
       {
     myCam.fieldofview = 30;
          elResitas2.m_LookAt = Cameratarget.transform;
           elResitas = -14;
           speed = 14;
           aimLayer.weight -= Time.deltaTime / aimDuration;
       }
     

}
}
1

There are 1 answers

1
Wajid On

You are trying to access property with wrong name. You are trying to access Field Of View Property Of Camera as fieldofview , you need to replace fieldofview with fieldOfView Everywhere you have used it.