Search Unity

Cinemachine Volume Extension causes the Inspector to break after saving scene/prefab

Discussion in 'Cinemachine' started by Onat-H, Apr 3, 2019.

  1. Onat-H

    Onat-H

    Joined:
    Mar 11, 2015
    Posts:
    195
    Edit: The best way to reproduce is actually making a prefab out of a vcam with the volume extension and opening it in prefab mode or dragging it into the scene again.

    I'm on 2019.1b and the most recent cinemachine and HDRP versions. I have added the volume extensions to all my scene cameras. After saving the scene and reopening, this is how the inspector looks when selecting one of these cameras in the hierarchy:

    Bildschirmfoto 2019-04-03 um 14.17.47.png
     
    Last edited: Apr 3, 2019
    Hozgen90 likes this.
  2. Onat-H

    Onat-H

    Joined:
    Mar 11, 2015
    Posts:
    195
    The following errors are spammed in the console (they seem to be unrelated first at least for me, although this only happens with the said combination)

    NullReferenceException: Object reference not set to an instance of an object
    Unity.Scenes.Editor.ConversionWarningsGui.GetWarnings (UnityEngine.GameObject gameobject) (at Library/PackageCache/com.unity.entities@0.0.12-preview.29/Unity.Scenes.Editor/ConversionWarningsEditor.cs:52)
    Unity.Scenes.Editor.ConversionWarningsGui.GetWarning (UnityEditor.Editor editor) (at Library/PackageCache/com.unity.entities@0.0.12-preview.29/Unity.Scenes.Editor/ConversionWarningsEditor.cs:37)
    Unity.Scenes.Editor.ConversionWarningsGui.Callback (UnityEditor.Editor editor) (at Library/PackageCache/com.unity.entities@0.0.12-preview.29/Unity.Scenes.Editor/ConversionWarningsEditor.cs:24)
    UnityEditor.Editor.DrawHeader () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/Editor.cs:731)
    UnityEditor.UIElements.EditorElement.DrawEditorLargeHeader (System.Boolean& wasVisible) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/EditorElement.cs:247)
    UnityEditor.UIElements.EditorElement.DrawEditorHeader (UnityEngine.Object target, System.Boolean& wasVisible) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/EditorElement.cs:206)
    UnityEditor.UIElements.EditorElement.HeaderOnGUI () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/EditorElement.cs:161)
    UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:278)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)


    ArgumentException: Getting control 0's position in a group with only 0 controls when doing repaint
    Aborting
    UnityEngine.GUILayoutGroup.GetNext () (at /Users/builduser/buildslave/unity/build/Modules/IMGUI/LayoutGroup.cs:117)
    UnityEngine.GUILayoutUtility.DoGetRect (System.Single minWidth, System.Single maxWidth, System.Single minHeight, System.Single maxHeight, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at /Users/builduser/buildslave/unity/build/Modules/IMGUI/GUILayoutUtility.cs:464)
    UnityEngine.GUILayoutUtility.GetRect (System.Single width, System.Single height, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at /Users/builduser/buildslave/unity/build/Modules/IMGUI/GUILayoutUtility.cs:441)
    UnityEngine.GUILayout.Space (System.Single pixels) (at /Users/builduser/buildslave/unity/build/Modules/IMGUI/GUILayout.cs:219)
    UnityEditor.Editor.DrawHeader () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/Editor.cs:719)
    UnityEditor.UIElements.EditorElement.DrawEditorLargeHeader (System.Boolean& wasVisible) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/EditorElement.cs:247)
    UnityEditor.UIElements.EditorElement.DrawEditorHeader (UnityEngine.Object target, System.Boolean& wasVisible) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/EditorElement.cs:206)
    UnityEditor.UIElements.EditorElement.HeaderOnGUI () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/EditorElement.cs:161)
    UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:295)
    UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:481)
    UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent () (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:455)
    UnityEngine.UIElements.UIR.ImmediateRenderer.Draw (UnityEngine.UIElements.UIR.DrawChainState dcs) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/Renderer/UIRenderer/UIRenderers.cs:447)
    UnityEngine.UIElements.UIR.UIRenderDevice.ContinueChain (UnityEngine.UIElements.UIR.RendererBase head, UnityEngine.UIElements.UIR.DrawChainState dcs, System.Boolean outerChainsWithMeshRenderer) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/Renderer/UIRenderer/UIRenderDevice.cs:841)
    UnityEngine.UIElements.UIR.ZoomPanRenderer.Draw (UnityEngine.UIElements.UIR.DrawChainState dcs) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/Renderer/UIRenderer/UIRenderers.cs:419)
    UnityEngine.UIElements.UIR.UIRenderDevice.ContinueChain (UnityEngine.UIElements.UIR.RendererBase head, UnityEngine.UIElements.UIR.DrawChainState dcs, System.Boolean outerChainsWithMeshRenderer) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/Renderer/UIRenderer/UIRenderDevice.cs:841)
    UnityEngine.UIElements.UIR.UIRenderDevice.DrawChain (UnityEngine.UIElements.UIR.RendererBase head, UnityEngine.Rect viewport, UnityEngine.Matrix4x4 projection, UnityEngine.Texture atlas) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/Renderer/UIRenderer/UIRenderDevice.cs:824)
    UnityEngine.UIElements.UIRRepaintUpdater.DrawChain (UnityEngine.Rect topRect, UnityEngine.Matrix4x4 projection) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/Renderer/UIRRepaintUpdater.cs:218)
    UnityEngine.UIElements.UIRRepaintUpdater.Update () (at /Users/builduser/buildslave/unity/build/Modules/UIElements/Renderer/UIRRepaintUpdater.cs:190)
    UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTree () (at /Users/builduser/buildslave/unity/build/Modules/UIElements/VisualTreeUpdater.cs:70)
    UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event e) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/Panel.cs:589)
    UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:240)
    UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:78)
    UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at
     
  3. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    There is a bug in Unity making conditionally-compiled scripts such as CinemachineVolumeSettings not work correctly with prefabs.

    There is a simple workaround until the bug is fixed, but you'll have to modify Cinemachine to remove the conditional from the script. You can embed Cinemachine in your project, and then change CinemachineVolumeSettings.cs. Right at the top, instead of
    Code (CSharp):
    1. #if CINEMACHINE_POST_PROCESSING_V3
    put
    Code (CSharp):
    1. #if true || CINEMACHINE_POST_PROCESSING_V3
     
  4. Onat-H

    Onat-H

    Joined:
    Mar 11, 2015
    Posts:
    195
    Great, thank you :) How can I embed cinemachine?
     
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Copy it from the package cache to your project's Packages directory, and delete the Cinemachine line from Packages/manifest.json
     
  6. Onat-H

    Onat-H

    Joined:
    Mar 11, 2015
    Posts:
    195
    Thanks :)
     
    Gregoryl likes this.
  7. fogsight

    fogsight

    Joined:
    Apr 6, 2010
    Posts:
    65
    I've got almost identical message (Unity 2019.1.3f1), with the same broken inspector display, to this one, when deleted script from the project which was on the active prefab used on the scene. Restoring script back fixed the error and got inspector view back on that object. Prefab was just a bunch of ProBuilder objects for the scenery with one Rigidbody with a script.

    Oh yea, this one was mixed in as well. They continue spamming indefinitely as fast as they can.
     
  8. SAZ_1

    SAZ_1

    Joined:
    Mar 26, 2013
    Posts:
    6
    I'm having the exact same issue ... unfortunately my cinemachine doesn't have a CinemachineVolumeSettings.cs and I can't add the original script back in... any ideas anyone? ...


    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. Unity.Scenes.Editor.ConversionWarningsGui.GetWarnings (UnityEngine.GameObject gameobject) (at Library/PackageCache/com.unity.entities@0.0.12-preview.29/Unity.Scenes.Editor/ConversionWarningsEditor.cs:52)
    3. Unity.Scenes.Editor.ConversionWarningsGui.GetWarning (UnityEditor.Editor editor) (at Library/PackageCache/com.unity.entities@0.0.12-preview.29/Unity.Scenes.Editor/ConversionWarningsEditor.cs:37)
    4. Unity.Scenes.Editor.ConversionWarningsGui.Callback (UnityEditor.Editor editor) (at Library/PackageCache/com.unity.entities@0.0.12-preview.29/Unity.Scenes.Editor/ConversionWarningsEditor.cs:24)
    5. UnityEditor.Editor.DrawHeader () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/Editor.cs:730)
    6. UnityEditor.UIElements.EditorElement.DrawEditorLargeHeader (System.Boolean& wasVisible) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/EditorElement.cs:263)
    7. UnityEditor.UIElements.EditorElement.DrawEditorHeader (UnityEngine.Object target, System.Boolean& wasVisible) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/EditorElement.cs:224)
    8. UnityEditor.UIElements.EditorElement.HeaderOnGUI () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/EditorElement.cs:179)
    9. UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:278)
    10. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    11.  
     
  9. fogsight

    fogsight

    Joined:
    Apr 6, 2010
    Posts:
    65
    Code (CSharp):
    1. using UnityEditor;
    2.  
    3. public class RemoveMissingScriptsUtility : Editor {
    4.  
    5.     [MenuItem("Edit/Remove Missing Scripts")]
    6.     private static void RemoveMissingScripts() {
    7.         for (int i = 0; i < Selection.gameObjects.Length; i++) {
    8.             GameObjectUtility.RemoveMonoBehavioursWithMissingScript(Selection.gameObjects[i]);
    9.         }
    10.     }
    11. }
    Put it in the folder named Editor, then select the object and run the script from Edit menu.
     
    Last edited: May 23, 2019
    Th0re likes this.
  10. Th0re

    Th0re

    Joined:
    Sep 4, 2015
    Posts:
    39
    Whew, thanks! Was about to panic that a removed script (not Cinemachine) would totally wreck a game object. This worked! Extra thanks fogsight :)
     
    fogsight likes this.
  11. fogsight

    fogsight

    Joined:
    Apr 6, 2010
    Posts:
    65
    Somehow Cinemachine 2.3.3 causes this bug. Removing this package removes the bug. Same thing happens in Unity 2019.1.4f1 with this package.
     
  12. fogsight

    fogsight

    Joined:
    Apr 6, 2010
    Posts:
    65
    Update: Narrowed down the problem and created a bug report. (1157537_jlhi622qp5pss45k)
    Just installing two packages in an empty project triggers it. 2D Animation 2.1.0 and Cinemachine 2.3.3
     
    Last edited: May 25, 2019
    boorch likes this.
  13. AAK_Lebanon

    AAK_Lebanon

    Joined:
    May 30, 2015
    Posts:
    77
    I have exactly the same issue, I am using Unity 2019.1.2f1 and the only preview package I installed is: 2D PSD Importer preview.3-1.1.0 (I don't use Cinemachine in this project)

    that's happened to me many times but I don't know how to reproduce it, what I know is that I changed the name of a script and now this is happening to me, and for an unknown reason, the Provided script (RemoveMissingScriptsUtility) is not working anymore ! it was working before I swear!
     
  14. AAK_Lebanon

    AAK_Lebanon

    Joined:
    May 30, 2015
    Posts:
    77
    Actually, I reported now a bug (1165104_u4ortou30c7of93b), I can reproduce this behavior if I create an Empty Project and installed the 2D PSD Importer preview.3-1.1.0 package. if you create an empty GameObject and attach an empty script to it, everything, of course, should work as expected in the inspector, however, if you change the script name (without changing the script's file name) you will see that the ins[ector is broken and you will see the error messages mentioned on this thread...