CinemachineExtension requires a Cinemachine Virtual Camera component

Hello, I have a problem with Cinemachine virtual camera. Something weird happened after upgrading the package in package manager.
Unity version: 2022.3.53f1
Cinemachine version: 2.10.3
Just for reference, I have this setup:
image

First of all, sometimes, when trying to add CinemachineVirtualCamera component, it just doesn’t listed in the list of components at all and sometimes it just shown with “Blank page” icon instead of “Half gear/half red triangle” icon.
Second, 100% of the time, even though the camera itself functioning as intended, the error appears in the console:

CinemachineExtension requires a Cinemachine Virtual Camera component
UnityEngine.Debug:LogError (object)
Cinemachine.CinemachineExtension:ConnectToVcam (bool) (at ./Library/PackageCache/com.unity.cinemachine@2.10.3/Runtime/Core/CinemachineExtension.cs:67)
Cinemachine.CinemachineConfiner:ConnectToVcam (bool) (at ./Library/PackageCache/com.unity.cinemachine@2.10.3/Runtime/Behaviours/CinemachineConfiner.cs:94)
Cinemachine.CinemachineExtension:OnScriptReload () (at ./Library/PackageCache/com.unity.cinemachine@2.10.3/Runtime/Core/CinemachineExtension.cs:49)

Third, I can’t override my “Cameras” prefab, because it show this:


And also this appears in the console:

The referenced script on this Behaviour (Game Object '') is missing!

Things I tried:

  1. Deleted cinemachine package from package manager and also deleted everything related to cinemachine in the project. Then reinstalled the package. Doesn’t really helped at all, the same things keep happening.
  2. “Reimport All”
  3. Steps described in this post:
    "CinemachineExtension requires a Cinemachine Virtual Camera component" randomly appearing - #8 by antoinecharton
    Also doesn’t helped at all.

Please help🥲

Just discovered that inside “Cameras” prefab, the structure looks differently:


And on the Virtual Camera object, it is indeed a non-existing script:

Looks like you’re missing the CinemachineVirtualCamera behaviour. Try setting the missing script to that.

Error while saving Prefab: 'Assets/Prefabs/Cameras/Cameras.prefab'. You are trying to save a Prefab with a missing script. This is not allowed.
Please change the script or remove it from the GameObject 'Virtual Camera'.
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()

To clarify a little bit more, this is how the structure looks like in the Scene:
image

image

image

And for some reason it looks like this in prefab editing mode:
image

image

image

image

So you should go into prefab edit mode, and replace the missing script with CinemachineVirtualCamera, then save. What happens when you do that?

This
Anyway, I fixed the problem by deleting Virtual Camera object from prefab and just re-added it with the same components. But tbh I still have no idea what exacty caused prefab to appear as this structure in the prefab editing mode while in the scene it looks like this

The reason they look different is that CM2 is implemented using hidden GameObjects (that’s what the “cm” thing is), but those objects cannot be hidden when editing the prefab itself.

These hidden GameObjects and the resulting confusion was one of the main motivators for CM3, which has eliminated the hidden GameObjects. I would recommend upgrading if possible (but be careful - it might require some non-trivial work. See our upgrade guide here: Upgrading a Project from Cinemachine 2.X | Cinemachine | 3.1.2)

1 Like