Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Duplicated UniversalAdditionalCameraData

Discussion in 'Universal Render Pipeline' started by KreizLand, Feb 2, 2020.

  1. KreizLand

    KreizLand

    Joined:
    Jul 12, 2017
    Posts:
    55
    For some reason I have 2 of this components on 1 camera...
    Tried to delete camera but only one UniversalAdditionalCameraData was removed, have no Idea what to do with it. Project is not huge so I can send it to Unity but I wanted to finish it ASAP so hopefully there is a way to do it fast and easily
    upload_2020-2-2_15-39-47.png
     
    Fangh, dpt2, LoganPark and 2 others like this.
  2. KreizLand

    KreizLand

    Joined:
    Jul 12, 2017
    Posts:
    55
    I`m not shure how but I have just fixed it within 30 secs after posting it
    Just remove camera component on the prefab in the scene editor (DO NOT OVERRIDE) then right click - revert, so its done. The duplicated component will be removed so all you need to do is apply changes to the prefab
     
  3. Elvar_Orn

    Elvar_Orn

    Unity Technologies

    Joined:
    Dec 9, 2019
    Posts:
    158
    Hey @KreizLand ,
    Do you have any idea what you did that made the component appear twice?

    I'm trying to hunt down the cause for this but having a hard time.
     
  4. KreizLand

    KreizLand

    Joined:
    Jul 12, 2017
    Posts:
    55
    Yeas I know how to do it
    First of all I had an old project without URP and some prefab with camera.
    After importing URP it automatically added this component to this prefab with camers on the scene - but this new component doest apply to prefab!
    Then we try to edit prefab and our prefab with camera doest have this component and its being added automatically again - after saving and going to the scene view it has prefabs component and the overlapping one that was add after importing URP

    Hope it helps
     
    blraj likes this.
  5. KreizLand

    KreizLand

    Joined:
    Jul 12, 2017
    Posts:
    55
    In a few words:
    We have prefab of the camera with this URP component that is not applied to prefab.
    When we edit this prefab its automatically add another one (cuz the one we have on the scene is overriding our prefab and not applied to it)
    After saving prefab with this URP component in Prefab editor we have 2 of this cpmonents on scene
     
    Last edited: Feb 16, 2020
  6. Chris_Payne_QS

    Chris_Payne_QS

    Joined:
    Jul 16, 2016
    Posts:
    83
    I've got a very similar setup with a camera inside a prefab, but I'm getting continuous spamming of:
    "Can't add 'UniversalAdditionalCameraData' to SceneCamera because a 'UniversalAdditionalCameraData' is already added to the game object!"
    Also the Scene window fails to render anything at all, though Game still works. The constant error messages stop whenever the scene window loses focus.

    I've hacked out the [DisallowMultipleComponent] on UniversalAdditionalCameraData to prevent the error spamming and followed Kreizland's steps to remove it from the prefab, but Unity crashed...
     
    Last edited: Mar 13, 2020
    azeem_ehsan and tonialatalo like this.
  7. garrido86

    garrido86

    Joined:
    Dec 17, 2013
    Posts:
    234
    I also get this when inspecting a prefab that has a camera with this component. After closing the prefab back to the normal scene, then it get's added. Reverting the added component from the prefab-diff dropdown menu solves this issue. Enviroment: Unity 2019.3.3f1, Windows 10 x64 and Standalone as player target and URP graphics pipeline.
     
    tonialatalo likes this.
  8. erikabar

    erikabar

    Unity Technologies

    Joined:
    Jan 26, 2017
    Posts:
    36
    hey! what Universal RP version are you on? I just tried to reproduce by following these steps:
    1. Create a Camera prefab in Builtin Pipeline
    2. Import Universal RP package (7.3.1) from the package manager
    3. Open the Camera prefab
    4. Do some changes (add a dummy script), save the prefab
    5. Close the prefab preview back to the scene

    I had no luck to reproduce this issue, am I doing something differently?
     
  9. Turkenberg

    Turkenberg

    Joined:
    Jan 31, 2018
    Posts:
    1
    Hi,

    am having the exact same issue.

    My setup is a bit different:
    When game is playing in FPS mode --> no issue
    When game is running in VR mode (WMR) --> Scene camera doesn't render anything.

    I have a combination of two logs appearing once per frame when I try to switch to scene view while also in VR & play mode.

    --> Info log:
    Can't add 'UniversalAdditionalCameraData' to SceneCamera because a 'UniversalAdditionalCameraData' is already added to the game object!
    UnityEngine.GameObject:AddComponent(Type)
    UnityEditorInternal.ComponentUtility:ReplaceComponentsIfDifferent(GameObject, GameObject, IsDesiredComponent)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
    --> Exception level:
    ArgumentNullException: Value cannot be null.
    Parameter name: dest
    UnityEditor.EditorUtility.CopySerializedIfDifferent (UnityEngine.Object source, UnityEngine.Object dest)
    (at <6f28216fea9f453abf2e05b770ed3ee4>:0)
    UnityEditorInternal.ComponentUtility.ReplaceComponentsIfDifferent (UnityEngine.GameObject src, UnityEngine.GameObject dst, UnityEditorInternal.ComponentUtility+IsDesiredComponent componentFilter) (at <6f28216fea9f453abf2e05b770ed3ee4>:0)
    UnityEditor.SceneView.UpdateImageEffects (System.Boolean enable) (at <6f28216fea9f453abf2e05b770ed3ee4>:0)
    UnityEditor.SceneView.SetupCamera () (at <6f28216fea9f453abf2e05b770ed3ee4>:0)
    UnityEditor.SceneView.OnGUI () (at <6f28216fea9f453abf2e05b770ed3ee4>:0)
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    UnityEngine.UIElements.UIR.RenderChain.Render (UnityEngine.Rect viewport, UnityEngine.Matrix4x4 projection, UnityEngine.UIElements.PanelClearFlags clearFlags) (at <a6a3aac9b47844afbb8dcc407683ae01>:0)
    UnityEngine.UIElements.UIRRepaintUpdater.DrawChain (UnityEngine.Rect viewport, UnityEngine.Matrix4x4 projection) (at <a6a3aac9b47844afbb8dcc407683ae01>:0)
    UnityEngine.UIElements.UIRRepaintUpdater.Update () (at <a6a3aac9b47844afbb8dcc407683ae01>:0)
    UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase phase) (at <a6a3aac9b47844afbb8dcc407683ae01>:0)
    UnityEngine.UIElements.Panel.UpdateForRepaint () (at <a6a3aac9b47844afbb8dcc407683ae01>:0)
    UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event e) (at <a6a3aac9b47844afbb8dcc407683ae01>:0)
    UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <a6a3aac9b47844afbb8dcc407683ae01>:0)
    UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <a6a3aac9b47844afbb8dcc407683ae01>:0)
    UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <59837000ebf54955a9cb1d31caa86097>:0)


    To me it seems that the duplicate Universal Additional Data Camera Data does not generate the issue right away, but obvsly Editor fails on this.

    I am however not able to reproduce this issue with a vanilla project whatsoever...

    But no modifications had been done on scene camera and other internal editor stuff.

    Turk
     
  10. erikabar

    erikabar

    Unity Technologies

    Joined:
    Jan 26, 2017
    Posts:
    36
    Hey Turk! Would you mind reporting this issue with the project attached so we could investigate?
     
  11. Emanx140

    Emanx140

    Joined:
    Jan 13, 2017
    Posts:
    9
    Hi!

    Same issue here.
    I think it can be somehow connected with upgrading prefabs to a new version.

    Found how to replicate it:
    1. Create a new LWRP project in old version unity. In my case, it was 2019.2.5f1
    2. Make a Camera prefab.
    3. Open prefab, edit something, and save prefab.
    4. Upgrade project to the latest Unity version. In my case, it was 2019.3.10f1
    5. Open prefab, edit something, and save prefab.
    6. Select the Camera in the scene hierarchy.
     
  12. Soulside

    Soulside

    Joined:
    Nov 1, 2018
    Posts:
    30
    I got this errors after merging two branches: branch_a (Unity 2019.3.6f1 version with implemeted Universal Render Pipeline) and branch_b (before the merge the project was imported in Unity 2019.2.1f1).

    I've merged changes from branch_a to branch_b. Removed the Library and Obj folders and imported the project in Unity 2019.3.6f1 version. Android import. When I opened prefab with our MainCamera (this prefab is also present in our Main scene) I've got the errors mentioned above.

    So I removed the camera, saved the prefab. And added the camera again. The errors disappeared.
    Maybe it helps somebody.
     
    Sryall812 likes this.
  13. WaifuAequus

    WaifuAequus

    Joined:
    Sep 15, 2019
    Posts:
    2
    Is there a fix for this issue.. I spent all day making on my platformer game, but then this issue appeared and I can't see a thing in scene view. I tried deleting the camera and adding a new one, but it messes everything else up, changing the player to be gigantic in the scene view, the light attached to the player is moving irregularly in comparison to the player and the size of the camera doesn't add up with the size of everything else. The camera size seems to be huge as well in comparison to the old camera, and that's despite the size saying that it's smaller in the inspector.

    I have no idea what to do to fix my project..

    Any help?
     
    Last edited: May 11, 2020
  14. LuisEGV

    LuisEGV

    Joined:
    Jul 21, 2015
    Posts:
    36
    Same problem. Help please!
     
  15. WaifuAequus

    WaifuAequus

    Joined:
    Sep 15, 2019
    Posts:
    2
    I managed to fix this. I'm sorry I wasn't able to answer sooner, but I fixed it by copying the camera component in inspector then deleting it and pasting it back in. That way I managed to avoid everything changing in weird ways.

    If you haven't found a solution already, I hope it helps :3
     
  16. LuisEGV

    LuisEGV

    Joined:
    Jul 21, 2015
    Posts:
    36
    I don’t remember how I solved it, it happened again another 2 times in the same day, but then It stopped. If it happens again I’ll try your method. Thanks
     
  17. RedEarth

    RedEarth

    Joined:
    Nov 4, 2016
    Posts:
    19
    For what it's worth, also just experienced this issue. My camera prefab had a copy of the urp additional camera data, and the scene was trying to automatically add another.

    Solve, for me, was to revert the 2nd additional camera data, in essence removing it and using the one already on the prefab.

    Project was converted to URP.

    2019.4.0f1
     
    LuisEGV likes this.
  18. Kvartzweiss

    Kvartzweiss

    Joined:
    Mar 17, 2020
    Posts:
    1
    I got the same problem. But it only happens when I open prefab assets, and I can't see anything when trying to edit prefabs in prefab mode. happenned randomly to a skeleton prefab right now, I haven't even changed anything on it
     

    Attached Files:

  19. Ruuds

    Ruuds

    Joined:
    Dec 3, 2017
    Posts:
    16
    Exact same issue here Unity 2019.4.3f1
     
  20. stachojakub

    stachojakub

    Joined:
    Oct 18, 2018
    Posts:
    2
    Hi, I got the same problem but I managed to fix it.

    The problem is that you got two same components of URP... (something), which are assigned to the same object where is your camera component.
    The way to fix it is :
    1. Remove Camera component from your GO/ Prefab
    2. Assign a new Camera component to the same GO/ Prefab
    3. Remove Camera component from your GO/ Prefab
    4. Assign a new Camera component to the same GO/ Prefab

    This will remove an additional URP component and let there just one.

    Hope it helped.
     
  21. L2GX

    L2GX

    Joined:
    Aug 19, 2016
    Posts:
    42
    Maybe best not to have cameras in your prefab but just add the component in the scene only?
     
  22. pojoih

    pojoih

    Joined:
    Mar 30, 2013
    Posts:
    218
    Happens to me as well. My case is an immutable Prefab from a package contains Nested Prefab [CameraRig] from the SteamVR Package (in Project, not immutable). The immutable Prefab now contains the Universal Additional Camera Data as well as the SteamVR Prefab, resulting in Exception talked about above.
     
  23. AugustinDarreHVR

    AugustinDarreHVR

    Joined:
    Mar 16, 2020
    Posts:
    2
    The issue seems to happen when the camera component is inside the prefab. Making this component as override for your prefab will remove this exception.
    Reproduced in Unity 2019.4.21f1 LTS with Oculus XR Plugin using the OVRCameraRig.
     
  24. God-at-play

    God-at-play

    Joined:
    Nov 3, 2006
    Posts:
    330
    I'm having the same issue in 2019.4.25f1. I have a player prefab with UniversalAdditionalCameraData added, but then there's a prefab variant of that prefab, and the variant adds it own component, and then the prefab in a scene adds its own component as well.

    If I try to revert the adding of the component, it comes back. At this point I don't have a duplicate, which means the variant replaces the original component, even though the removal of the first component doesn't show up in the prefab change list (only the addition). This is also the case for the prefab in a scene, that one adds a component but doesn't show a removal. And at this point there's only one version thankfully...so far.

    For now I don't get exceptions, but the state of this prefab is pretty concerning, especially because it's our player prefab.

    EDIT: Ok I think I fixed it, previously I only removed the camera component on the variant. Once I realized that, I went to the "innermost"/original prefab, copied and removed the camera component, and then pasted it back in. That then led to exceptions every frame, which I fixed by reverting the added UniversalAdditionalCameraData component that was in the scene itself. So I'm guessing at this point we'll have to fix all our scenes since those will have duplicates.
     
    Last edited: May 17, 2021
  25. kusi2017

    kusi2017

    Joined:
    Jan 25, 2017
    Posts:
    2
    I have found solution for such problem. At least it helped me.
    Can't add 'UniversalAdditionalCameraData' to SceneCamera because a 'UniversalAdditionalCameraData' is already added to the game object!
     
    teamtron3 likes this.
  26. kamicazer7

    kamicazer7

    Joined:
    Oct 27, 2012
    Posts:
    7
    Hey, just wanted to reply with how I faced the issue and how I solved it:

    1) Migrated from legacy rendering to URP
    2) Had a camera as part of a prefab in the scene (prefab created prior to migration and without the component 'Universal Additional Camera Data' added to it.
    3) Loaded the scene with that prefab already instantiated in the scene (I saw the component 'Universal Additional Camera Data' with the + override prefab symbol, which means its not part of the prefab
    4) Opened the prefab to edit it (to remove the post processing scripts that were now gone as a URP requiremnent)
    5) Saved the prefab (Note 'Universal Additional Camera Data' was added during prefab mode as it is probably part of the OnValidade for camera now)
    6) Back to the scene I see 2 components 'Universal Additional Camera Data' added for the same camera , one from the prefab save, and another one from the scene prefab instance.

    How to solve:
    1) Go to another scene where there is no instance of the prefab with the camera. Edit the prefab and save it with the component, making sure there's only 1 'Universal Additional Camera Data'.
    2) Go back to the scene where that camera was instantiated and see that it doesn't try to add another 'Universal Additional Camera Data'.
    Additional:
    3) If you have already saved both the scene and the prefab, try getting a backup from a previous version of the scene or prefab without duplicate of 'Universal Additional Camera Data'.
    4) If everything fails, you can remove the camera component itself and make a new one.

    Whatever script is adding the component 'Universal Additional Camera Data' should really be checking if there are no duplicates, specially when you force blocking the removal of that component. I can understand this is a dependency, but you either have one or the other, not both.
     
    Last edited: Jun 4, 2021
    cheesepant and lmartellmc like this.
  27. dpt2

    dpt2

    Joined:
    Jun 15, 2021
    Posts:
    50
    This still happens in Unity 2020.1.9 >_<
     
  28. Ethaninja

    Ethaninja

    Joined:
    Jan 7, 2013
    Posts:
    277
    Yep, can confirm. This is a pretty tedious bug, and makes me not want to use URP, but I have to in order to get certain mechanics to work. It's somewhat fixable, but very finnicky, and over a year later no fix
     
    pojoih likes this.
  29. lmartellmc

    lmartellmc

    Joined:
    Aug 3, 2018
    Posts:
    23
    Just ran into the same issue and took a few hours to track it down. 2020.3.4f1. Prefab had an additional component on instances in the scene.
     
  30. Nucky9

    Nucky9

    Joined:
    Apr 8, 2016
    Posts:
    11
    Still in 2020.3.26f as well, and very annoying. A hacky workaround is to go to one of the UniversalAdditionalCameraData components, go to debug mode, and drag a different script into the Script slot for the component. That will break the component and allow you to remove it.
     
    Harinezumi likes this.
  31. tonialatalo

    tonialatalo

    Joined:
    Apr 23, 2015
    Posts:
    60
    I had this in prefab instances where have a camera - finally got it fixed by reverting the addition of the extra component for the prefab, i mean the prefab feature to revert the addition of the component. Then it didn't re-appear anymore.
     
  32. Gilvar

    Gilvar

    Joined:
    Feb 4, 2017
    Posts:
    1
    I just ran into this issue across all of my scenes. Here's what my scenario was:
    1. Created prefab of main camera (needed scripts attached to the camera)
    2. Used camera prefab on all scenes in my game
    3. Retroactively added URP to all scenes individually & checked the Post Processing checkbox on camera instances instead of on the main camera prefab
    4. Everything was working fine and no Unity errors until I inspected the Main Camera prefab within my assets folder
      1. I didn't edit or touch anything, I only opened the Inspector window
    5. Error pops up & every camera instance now has two Universal Additional Camera Data components attached
      1. One of those components has the + symbol on it and you can't remove it unless you remove the Camera component itself
    Fixed it by:
    1. Checked the Post Processing checkbox in the main camera prefab
    2. Deleted the scene's main camera instance
    3. Added my camera prefab back into the scene
     
  33. xuruiunix

    xuruiunix

    Joined:
    Sep 13, 2019
    Posts:
    1
    thanks to @Gilvar ,@amicazer7,@God-at-play,@AugustinDarreHVR
    it seems UniversalAdditionalCameraData component do not work right in edit-play mode when you upgrade your old scene from standard pipeline to universal pipeline. click at camera then ,every thing goes well.
    delete old camera and add it again will solve this problem
    from unity 2020.2
    @erikabar
     
  34. BeorGames

    BeorGames

    Joined:
    Jul 28, 2018
    Posts:
    61
    Hi there!

    Just for the record, I ran into the same problem when upgrading from unity 2020.2.21 to 2022.1.0.
    It also screwed up my UI, but that's a different problem, it reseted the anchors and scales of some panels, nothing major.

    Removing the component solved the camera issue.
     
    Last edited: Jun 2, 2022
  35. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    376
    Unity 2022 still has this same problem...
    I deleted the second "UniversalAdditionalCameraData component" & then copied and pasted a new camera component & now I get an error in all of my scenes.

    MissingReferenceException: The object of type 'UniversalAdditionalCameraData' has been destroyed but you are still trying to access it.

    This managed to screw up all scenes in my project. Nto sure why the it affected all other scenes as well.

    -- My fix was to delete the VR camera prefab in the Hierarchy and then import a new VR camera.
     
    Last edited: Dec 6, 2022
  36. azeem_ehsan

    azeem_ehsan

    Joined:
    Mar 5, 2022
    Posts:
    3

    Solved this as , when in Prefab Edit Mode if I do some changes with CAMERA and when come back to the Scene View and selectoing the Camera in that Prefab , The Inspector shows 2 Scripts with Same Name "UniversalAdditionalCameraData" And I REMOVED by slecting that Script's option and Revert it.
     
    Marc-Saubion likes this.
  37. mobidus

    mobidus

    Joined:
    Mar 22, 2016
    Posts:
    22
    Can confirm this happens in 2021 lts version, too. However in my case not as difficult to solve as previous users mentioned. A duplicate UniversalAdditionalCameraData script appeared on my XR camera rig after a playtest. (Something to note may be that I changed the gameview to maximized while playing) As the script was not part of the prefab I was able to remove the duplicate script and everything went back to normal.
    On another note, my project migrated to urp a couple days ago
     
  38. kenorbik

    kenorbik

    Joined:
    Jan 9, 2023
    Posts:
    7
    Same with latest 2021.3, I've ended up somehow with two UniversalAdditionalCameraData as well which cannot be removed. Any reliable solutions?
     
  39. kenorbik

    kenorbik

    Joined:
    Jan 9, 2023
    Posts:
    7
    Ok, I've managed to remove duplicated MonoBehaviour component by editing .prefab file manually, and reload it from .prefab.
     
  40. NikMikk

    NikMikk

    Joined:
    Nov 4, 2015
    Posts:
    25
    For anything still getting this issue

    1. Delete the Camera prefab from all scenes
    2. Open the prefab and remove the Camera component & UniversalAdditionalCameraData
    3. Place the Camera prefab in the scenes you want to use it & save
    4. Open the prefab and add in the Camera component and save it
    This fixed the issue on our side with URP adding a duplicate UniversalAdditionalCameraData component to the Camera component which was the cause for our Scene View not rendering.
     
  41. teamtron3

    teamtron3

    Joined:
    Dec 16, 2022
    Posts:
    3
    Worked for me as well. Reset the Camera Settings, and then try to remove UniversalAdditionalCameraData again.