Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How to adjust background color with Cinemachine virtual camera?

Discussion in 'Scripting' started by huseyinbaba58, Aug 23, 2020.

  1. huseyinbaba58

    huseyinbaba58

    Joined:
    Feb 12, 2020
    Posts:
    146
    I suppose, Cinemachine hasn't got same features with camera.
    How can I adjust background color?
     
  2. MaximumTre

    MaximumTre

    Joined:
    Nov 28, 2015
    Posts:
    163
    As far as I can tell, Cinemachine 'cameras' are just proxy's for the main camera in the scene, so any changes applied to the camera work for the Virtual Cameras.
     
  3. huseyinbaba58

    huseyinbaba58

    Joined:
    Feb 12, 2020
    Posts:
    146
    I understood.
    How can I apply this changes?
     
  4. MaximumTre

    MaximumTre

    Joined:
    Nov 28, 2015
    Posts:
    163
    Code (CSharp):
    1. Camera mainCamera;
    2.  
    3. void Start()
    4. {
    5.      mainCamera = Camera.main;
    6. }
    7.  
    8. // ...
    9. void ChangeBGColor(Color color)
    10. {
    11.      mainCamera.backgroundColor = color;  // <---
    12. }
    13.  
     
  5. MaximumTre

    MaximumTre

    Joined:
    Nov 28, 2015
    Posts:
    163
    You also need to have your camera setup to use the background color instead of the skybox.
     
  6. huseyinbaba58

    huseyinbaba58

    Joined:
    Feb 12, 2020
    Posts:
    146
    Thanks sir.