Search Unity

PostProcessing Adapter conflicts with CM 2.3.3

Discussion in 'Cinemachine' started by fullbright_aaron, Apr 18, 2019.

  1. fullbright_aaron

    fullbright_aaron

    Joined:
    Aug 31, 2018
    Posts:
    8
    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.
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Yes there is. Follow these steps:
    1. MAKE A BACKUP
    2. Open an empty scene
    3. Use the package manager to uninstall Cinemachine
    4. Delete the CinemachinePostProcessing folder from your assets
    5. Re-install Cinemachine
    Now, you should be able to open a real scene and have all the references working
    Let me know if this works for you.
     
  3. fullbright_aaron

    fullbright_aaron

    Joined:
    Aug 31, 2018
    Posts:
    8
    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.
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    The GUIDs should be the same.

    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.
     
  5. fullbright_aaron

    fullbright_aaron

    Joined:
    Aug 31, 2018
    Posts:
    8
    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.
     

    Attached Files:

  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    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
    Code (CSharp):
    1. #if CINEMACHINE_POST_PROCESSING_V2
    to
    Code (CSharp):
    1. #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.
     
  7. Vallar

    Vallar

    Joined:
    Oct 18, 2012
    Posts:
    177
    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.
     
  8. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    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.
     
  9. Vallar

    Vallar

    Joined:
    Oct 18, 2012
    Posts:
    177
    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.
     
    Gregoryl likes this.
  10. mrtenda

    mrtenda

    Joined:
    Jun 6, 2017
    Posts:
    73
    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.
     
  11. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    mrtenda likes this.
  12. fullbright_aaron

    fullbright_aaron

    Joined:
    Aug 31, 2018
    Posts:
    8
    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.
     
    Bdelcast likes this.
  13. Bdelcast

    Bdelcast

    Joined:
    Jul 11, 2014
    Posts:
    25
    Is there any update on this? I cant figure out how to follow the case either, and it has been a few patches and I'm still getting the same problem.
     
  14. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
  15. fullbright_aaron

    fullbright_aaron

    Joined:
    Aug 31, 2018
    Posts:
    8
    Thanks for the update!
     
  16. av_signalspace

    av_signalspace

    Joined:
    Aug 31, 2018
    Posts:
    3
    It doesn't seem to be fixed in 2019.3.0b10.
    Do we have to wait for the final version ?
     
  17. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    You also need to upgrade CM to the latest 2.4.0, which is still in preview
     
  18. cpaul06

    cpaul06

    Joined:
    May 14, 2018
    Posts:
    4
  19. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    @cpaul06 You don't need that workaround with 2019.3. You should use a newer release of 2019.3.
    What problem are you seeing, exactly?
     
  20. cpaul06

    cpaul06

    Joined:
    May 14, 2018
    Posts:
    4
    Hey @Gregoryl I updated to Unity 2019.3.0f3 (latest on UnityHub), added post processing to the camera maincamera.PNG (also tried it on the virtual camera virtualcamera.PNG ) and the vignette is not showing in either the game or scene views.
     
  21. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Remove both of PP volumes, then use the Extensions dropdown in the vcam inspector to add a PostProcessing extension to the vcam. Put your PP profile there.
     
  22. cpaul06

    cpaul06

    Joined:
    May 14, 2018
    Posts:
    4
    Did as you said, added the PP extension, but still doesn't show up.
    Some other details: I have a project using the Universal Render Pipeline (with the default UniversalRP-MediumQuality) targeting Mobile.

    I thought that maybe it was something with my project settings, but it also happens when I created a new empty project (you can find the empty project here)

    upload_2020-1-11_10-29-9.png
     
  23. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    I checked your project. I found a couple things:
    - On your Main Camera, you need to check the Post Processing option under the Rendering tab.
    - Post Processing package is included in Universal RP package, so I removed the PP package from your example project. I also updated Cinemachine to 2.4.0 and Universal RP to 7.1.6.

    After doing the above, I added a Cinemachine Volume Settings extension, using the Add Extension button in the CinemachineVirtualCamera component.

    After these, your PP works for me. ;)
    See the attached images for more details.
     

    Attached Files:

    Last edited: Jan 15, 2020
    cpaul06 likes this.
  24. cpaul06

    cpaul06

    Joined:
    May 14, 2018
    Posts:
    4
    Hey @gaborkb, thanks for the help. This seems to have done it.
    I suspect it might have been the duplicate Post Processing package and maybe something in Cinemachine 2.4.0 as it was released just a couple of days ago.
     
    gaborkb likes this.