Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
marky1124's avatar
marky1124
Explorer
13 years ago

OVRCameraController.cs - UnityEngine.Camera.fov is obsolete

Hi,

The following warning is displayed in Unity v4.2.0f4 when running the Oculus Tuscany Demo Project (OculusUnityIntegrationTuscanyDemo.unitypackage) found in SDK v0.2.3 :-

Assets/OVR/Scripts/OVRCameraController.cs(207,24): warning CS0618: `UnityEngine.Camera.fov' is obsolete: `use Camera.fieldOfView instead.'

Obviously it's a trivial issue at the moment, but it might be worth updating it before your next SDK release.

Cheers,
Mark

4 Replies

Replies have been turned off for this discussion
  • Yeah, there's work that needs to be done on the Unity integration kit.
    An example of unoptimized code:
    gameObject.camera.transform.Rotate(...)

    You can actually access the same transform by just calling
    transform.Rotate(...)

    Or even better, cache the transform in the awake method, and access the cached reference:

    private Transform myTransform;
    void Awake()
    {
    myTransform = GetComponent<Transform>();
    }
    void Update()
    {
    myTransform.Rotate(...)
    }
  • i know little to nothing about code, so ill bite the bullet ans ask are these solutions to the error if so could you show me where int the code for the overcameracontroller.cs i need to implement these changes. sorry for not understanding the code. and thanks for any help and advice.
  • They aren't errors, just warnings. This means that you could likely do nothing and be fine for the next few versions of unity.

    If you'd like to manually do something about them, the warnings should show up in your console. Simply double clicking the warning will open the script and take you to the line.
  • ahh ok thanks for the quick response, if its not necessary to fix then i will leave it to the developers capable hands to address the error so i dont mess it all up.