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:
    7
    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:
    2,949
    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:
    7
    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:
    2,949
    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:
    7
    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:
    2,949
    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:
    155
    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:
    2,949
    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:
    155
    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:
    29
    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:
    2,949
    mrtenda likes this.
  12. fullbright_aaron

    fullbright_aaron

    Joined:
    Aug 31, 2018
    Posts:
    7
    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:
    11
    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:
    2,949
  15. fullbright_aaron

    fullbright_aaron

    Joined:
    Aug 31, 2018
    Posts:
    7
    Thanks for the update!