I have some glowing objects in my scene, that with HDR off are inactive, so i want to add the option to turn HDR off in my settings to increase performance.

If the code bellow is correct, what should i write inside get component:

public GameObject currentActiveCamera;
currentActiveCamera.GetComponent<???>.hdr = false;
  • \$\begingroup\$ Shows lack of research. Just searching for camera and going down to HDR part in Unity Docs fixes this problem. \$\endgroup\$ – John Hamilton Dec 4 '16 at 4:49
  • \$\begingroup\$ @JohnHamilton i did, found nothing! \$\endgroup\$ – MrChips Dec 4 '16 at 5:49
  • \$\begingroup\$ docs.unity3d.com/ScriptReference/Camera.html do Ctrl+F type in hdr. That's a boolean that shows whether the HDR is enabled on that camera or not. \$\endgroup\$ – John Hamilton Dec 4 '16 at 5:59

Instead of using the GameObject type, use Camera.

    using UnityEngine;
    using System.Collections;

    public class CameraManager: MonoBehaviour 
        public Camera currentActiveCamera;

        void Start()
            currentActiveCamera.GetComponent<Camera>().hdr = false;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.