We’re upgrading a project to use Unity 2019.1 and CM 2.3.3. We were previously using the post processing adapter, which was under our Assets folder. I see now that the adapter is included in the CM package. This leads to compiler errors, because the scripts are now duplicated and there’s type conflicts.
The only way to fix this is to remove the adapter in the Assets folder to use the package version of the adapter, however this breaks the script references to the CinemachinePostProcessing effect on VCams that were using the adapter from versions 2.2.8 and earlier.
Is there a way to avoid having to fix every reference? We have hundreds.
No, this didn’t fix the issue. If it’s any help, the GUIDs on the files in the CinemachinePostProcessing folder are different than the ones on the same files included in the package for 2.3.3
I also discovered that I get different behavior if I try to do the steps in reverse. After installing CM 2.3.3, if I downgrade CM to 2.2.8 while in 2019.1, put the CinemachinePostProcessing folder back in the project, and then upgrade CM to 2.3.3, the PostProcessing files in the package version will be missing. This feels like a bug, even though it does “fix” the problem, especially given that if I update CM to 2.3.3 immediately after finishing upgrading the project to 2019.1 and without removing the CinemachinePostProcessing folder, the package version will have these files.
Here’s the thing: if you install the package and other files are already present that have the same GUIDs, the incoming GUIDs in the package will get remapped. That’s why you have to be careful to strip out all traces of CM and the adapter before you attempt to install CM 2.3.3.
I started from scratch following the instructions and confirmed that the GUIDs on the package version match the GUIDs on the adapter files I removed. I also checked inside of prefab and scene files for references to this GUID, and everything matches. I still get “The referenced script on this Behaviour is missing” warnings.
I am also noticing that saving VCams into Prefabs with the PostProcessing extension is breaking the prefab system. It is complaining that the extension is not a MonoBehaviour and refuses to save the asset. References to the extension script is removed if you try to save a VCam with this extension into a prefab file. Many of the VCams in the project I’m trying to upgrade are inside of prefab files.
If you try to save a gameobject with a VCam on it that uses the PP extension, the reference will disappear in the prefab editor view. If you try to instantiate the prefab, the reference will be missing. If you load the scene, all references to the PP extension on the VCams will break.
I created a clean Unity project in 2019.1 with the CM and PP packages to confirm this behavior.
Yes, you are tripping over a bug in Unity 2019.1 that causes conditionally-compiled scripts (such as PostProcessing extensions) to fail when used in some places, such as prefabs and timelines. We are working on a fix for this.
In the meantime, as a workaround, you can modify the scripts in question to remove the conditional compilation. Find com.unity.cinemachine/Runtime/PostProcessing/CinemachinePostProcessing.cs in your package cache, make it writable, and change #if CINEMACHINE_POST_PROCESSING_V2 to #if true || CINEMACHINE_POST_PROCESSING_V2
Alternatively, instead of directly patching your cache, you can embed CM in your project (copy the com.unity.cinemachine folder from the cache to your project’s Packages folder, and remove the corresponding entry from your manifest.json file). Then the mods will apply to that project only, and you can put them in source control.
I tried the first approach (just editing the script) and unfortunately that doesn’t work well. I made sure I had write access to the file, I modified the script and sure enough it worked. However when I quit Unity and go back in again, the same bug happens (the PP script turns into a missing script) so it works ONLY for the current session. I had to go back again, edit the file again, remove the bugged script, add them again and then add the profile.
Just thought I’d give a heads up. The second kind of worked but it destroyed all the data on the cameras and our setup so we had to do them from scratch. Also if you at any point decide to stop using the in-game scripts and go back to PackMan’s version, you’ll have to redo the setup again.
Sounds like you didn’t use the right procedure when embedding the package. What you have to do is to close Unity, then move (or copy) CM from the cache to your project’s Packages folder, then, before opening Unity, delete the CM entry from the manifest.jsaon. Then, open Unity.
If at any moment you have Unity open with multiple versions of CM in different places, Unity will remap all the meta-files. That’s probably why you lost everything and had to redo from scratch.
Ah, probably Unity being open (I quit it but had a bug report appear so might not have fully exited) while I was moving the packages. Anyway mainly wanted to warn about the first method (with the script edit) that it didn’t work for us.
Is there an item in the issue tracker for this? I’m eager to update to 2019.1 but I don’t trust myself to upgrade Cinemachine manually without breaking everything.
Btw, I don’t think we can see that page on FogBugz? In either case, looking forward to the patch. I’m eager to get my team onto the new version. Thanks for looking into the issue.
The good news is that it’s fixed. The bad news is that the fix will only come out in 2019.3, and is unlikely to be backported to previous Unity versions. Until then, you’re stuck with the workaround detailed here: PostProcessing Adapter conflicts with CM 2.3.3
I’m also seeing this using 2019.3.0f1, CM 2.3.4 (also tried with 2.4.0 preview 10), PostProcessing 2.2.2 and the workaround you mentioned earlier ( PostProcessing Adapter conflicts with CM 2.3.3 )