Search Unity

Bug VirtualCamera component not editable inside prefab variants

Discussion in 'Cinemachine' started by TimedragonX, Nov 4, 2022.

  1. TimedragonX

    TimedragonX

    Joined:
    Nov 3, 2017
    Posts:
    9
    This happens in version 2.9.1, but not in 2.8.9 in 2021.3.6f.

    The CinemachineVirtualCamera component cannot be edited inside prefab variants. When adding it, you get the message: "it is not possible to add this component to a prefab instance." It is still picked up by the brain though, but you can't edit any parameters.

    Is this a bug? As it is right now, this makes it impossible to use prefab variants with Cinemachine virtual cameras.
     
  2. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    I cannot reproduce the issue. Prefabs assets, prefab instances, and prefab variants all work with CinemachineVirtualCameras.

    Could you provide more details? (screenshots of your prefabs, the whole error message)
     
  3. TimedragonX

    TimedragonX

    Joined:
    Nov 3, 2017
    Posts:
    9
    Here's how I reproduce it:
    • Create a game object and make it into a prefab.
    • Create a variant of that prefab.
    • Open the variant in prefab mode and add a CinemachineVirtualCamera
    • Observe the following: https://imgur.com/a/lwBV9JL
     
    gaborkb likes this.
  4. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    This is unfortunately not supported well in Cinemachine 2 due to legacy reasons. The workaround is, as the error message says, to add a Cinemachine Virtual Camera to the Prefab Asset. Then you will be able to modify components on your vcam in prefab instances and variants.

    In Cinemachine 3.0 (in production), probably available from 2023.1, we have made a lot of refactors to align Cinemachine with Unity more closely. These changes include support for Prefabs for example. For more information on Cinemachine 3, see this post: https://forum.unity.com/threads/announcing-cinemachine-3-0.1361713/#post-8588281
     
    Gregoryl likes this.