Upgrading from Cinemachine 2.x to 3.x

Hi folks,

I’m upgrading from the Cinemachine 2.x package to 3.x, and going one by one through the code errors to adjust for the breaking changes.

One part where I’m stuck is adding a “Cinemachine component” via script. For example I’m attaching a noise module to a bunch of vcams like this:

vcam.AddCinemachineComponent<CinemachineBasicMultiChannelPerlin>();

But “AddCinemachineComponent” has been removed. Does anyone know the new way of doing this?

Thanks!

Oh well, exactly 30 seconds after posting this, I found:

vcam.GetOrAddComponent<CinemachineBasicMultiChannelPerlin>();

Hopefully this will do the trick.

1 Like