Search Unity

Removing "enabled Camera" requirement to aid integrations

Discussion in 'Cinemachine' started by ChrisIceBox, Nov 16, 2017.

  1. ChrisIceBox

    ChrisIceBox

    Joined:
    Sep 16, 2013
    Posts:
    334
    Hi, thanks for reading. I'm looking to integrate Cinemachine with Adventure Creator.

    AC uses a similar concept to CM's "Brain / Virtual" management, whereby the user creates GameCameras that the AC MainCamera (which is the only one that actually renders) then refers to for its own orientation.

    I would like to give users the ability to choose between AC and CM cameras as they please, which would involve treating the Cinemachine Brain like a regular AC GameCamera so that the AC MainCamera can refer to it (and, in turn, the active VirtualCamera) whenever a user wants.

    However, AC requires that any GameCamera's Camera component be disabled (since, like the VirtualCamera, it is only used for reference). I've found that the Cinemachine Brain stops updating if this is the case. In v2.0 (the latest official release as of writing), this is due to the following in CinemachineBrain.cs, line 453:

    if ((OutputCamera == null) || !OutputCamera.isActiveAndEnabled)

    Amending it to simply:

    if (OutputCamera == null)

    Resolves the issue and allows the integration.

    Would it be possible to make this change in the official release? Or at least optional / removed with a define? It would allow for the integration between the two assets, and may make things easier for other assets as well.

    tldr: Can we remove the need for the Cinemachine Brain's Camera component to be enabled?
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
  3. ChrisIceBox

    ChrisIceBox

    Joined:
    Sep 16, 2013
    Posts:
    334
    Thank you! Didn't see that the first time I went through the release notes.