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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Slow, Laggy scene camera Unity 2019.x

Discussion in 'Editor & General Support' started by POC0bob, Apr 16, 2020.

  1. POC0bob

    POC0bob

    Joined:
    Feb 22, 2017
    Posts:
    28
    Hello all,

    For a while now (unity 2019.2,2019.3.x [Currently running 2019.3.8]) the scene camera is very laggy/slow and keeps moving long after I let go of the WASD buttons - even with small/basic scenes. I have tried so many things including:
    • Change from DX11 to OpenGL Core
    • restart many times
    • Delete my graphics drivers using DDU and reinstalled
    • countless new scenes
    • turning off animated textures, sky, fog, etc
    • changing graphics level to lower settings
    • turning off GSync
    • Changing display settings per other forum posts I've seen
    • ensured nothing else was running such as Virus scanner, performance monitors, etc.
    • Changing clipping distance for SceneCamera to 500
    • Disabling PageFile
    • Using Task Manager to close any programs that monitor hardware, virus scanners, and overclocking software
    • Happens on both Intel XEON and Ryzen platforms
    • Happens in Unity 2018.x aswell

    I am so at a loss as to why this is happening and it is making unity useless to me. This has been going on for some time now, I have been to page 4 on google I even did the
    Code (CSharp):
    1. UnityEditor.EditorPrefs.SetBool("DeveloperMode", false);
    thing I found, I checked the performance monitor and all it tells me is something about the camera updating (100+ MS).

    Hardware:
    GTX 1070ti overclocked
    Ryzen 3900x overclocked
    32GB 3200GHz Corsair Vengence ram
    PNY SSD (512GB, 56% full)
    850Watt Platinum PSU Corsair.

    My hardware SHOULD be able to run unity just fine - I've even tried many fresh installs of Unity with and without unity hub...

    Am I just SOL with an unfixable issue? Its so frustrating....
     
    Last edited: Apr 16, 2020
    Better-Choice likes this.
  2. CovalenceSTU

    CovalenceSTU

    Joined:
    Sep 10, 2018
    Posts:
    63
    If you the far view distance for the Scene camera to something low (such as 1000m) does it get any better?

    Also, when you have the project open, is there a very large difference between the amount of RAM in use and the committed amount? Windows could be over-using the pagefile, and then lagging when it retrieves data from it (I had this happen before with an older laptop). You can disable the pagefile if this is the issue, but it will cause programs to crash if you use more then 32GB RAM (unlikely when running Unity, but still possible).
     
  3. POC0bob

    POC0bob

    Joined:
    Feb 22, 2017
    Posts:
    28
    Unity is using aprox. 5GBs of ram. Changing clipping distance to 1000m does not help at all.
     
  4. CovalenceSTU

    CovalenceSTU

    Joined:
    Sep 10, 2018
    Posts:
    63
    There should be a camera button on the top right of the Scene tab, click it and it will show the scene camera settings.
     
  5. POC0bob

    POC0bob

    Joined:
    Feb 22, 2017
    Posts:
    28
    I found it, but even setting it to 100m doesn't help.
     
  6. CovalenceSTU

    CovalenceSTU

    Joined:
    Sep 10, 2018
    Posts:
    63
    Oh :(

    Does it get better if you disable your pagefile? (instructions here) Since you have 32GB RAM disabling it shouldn't cause any problems.
     
  7. bobisgod234

    bobisgod234

    Joined:
    Nov 15, 2016
    Posts:
    1,042
    Run profiler on the editor while moving around. Provide more detail about the results here.
     
  8. POC0bob

    POC0bob

    Joined:
    Feb 22, 2017
    Posts:
    28






    When making changes in other UI elements, such as lighting, settings, browsing the Hierarchy it runs smoothly and quickly but as soon as I start moving the scene camera the frames/performance drops like a rock and the camera will keep moving sometimes as much as 10 seconds after letting go of any of the WASD buttons.

    Disabling PageFile did not help, even after a reboot.
     
  9. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,198
  10. POC0bob

    POC0bob

    Joined:
    Feb 22, 2017
    Posts:
    28
    The issue is not present in an empty scene, but populating it with a plain, some trees, a small amount of grass and some rocks from a NM pack stars to cause the issue and the more I add the worse it gets. I was using after burner by MSI and I just disabled it to test, made no difference.
     
  11. POC0bob

    POC0bob

    Joined:
    Feb 22, 2017
    Posts:
    28
  12. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,198
    Does that scene run fine when you enter play mode or make a Standalone build and play that? How does the profiler look for those cases (targeting Playmode or the Standalone, not Editor). Also, what does the Game view's Stats window/ Render Profiling Module show in terms of batch, SetPass call and tris count.
     
  13. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,198
    and do you have both Scene view and Game view open and visible at the same time? that'd be rendering the scene contents twice and it seems only half of you frame time is spend in the Scene view camera. Where's the rest of the time go?
     
  14. POC0bob

    POC0bob

    Joined:
    Feb 22, 2017
    Posts:
    28
    When in play mode or standalone build mode it runs perfectly fine. Good FPS and no lag/choppiness. I am in the default layout at the moment, so the Scene view and Game view are in separate tabs and not both visible at the same time but can be switch to them individually.

    Graphics: CPU: Main 99ms Render Thread: 1.5ms
    Batches 696
    Tris: 1.8m Verts: 3.1M
    SetPass calls: 119
    Shadow Casters: 0
    Animations: 0

    on URP


    I tried closing the game tab so it wasn't open, no change I also went into the Layers menu and hid all so there wasn't much in the scene and that also made no difference, still the same issue. This is beyond weird and so stressful. I do appreciate you all trying to help, I just ordered a NVMe m.2 PCIe Gen 4 drive so maybe that well help. I dunno, I am running out of options here and this doesn't seem to be a common issue so it could be anything..
     
    Last edited: Apr 16, 2020
  15. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,198
    I just spotted that FindMainCamera takes 31ms. The heck? Do you have multiple cameras or objects tagged as MainCamera?
     
  16. POC0bob

    POC0bob

    Joined:
    Feb 22, 2017
    Posts:
    28


    No, just the one.
     
  17. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,198
    I'm pretty sure that the issue lies there, just the camera rendering part is fine at 27ms but 2 FindMainCamera for 31 + 9 Ms. What do you get if you add a script with
    Debug.Log(GameObject.FindGameObjectsWithTag("MainCamera").Length);
    how many does it report?
    If only 1, please file a bug report, highlighting the time it takes to find the main camera. That's definitely not normal.
     
  18. POC0bob

    POC0bob

    Joined:
    Feb 22, 2017
    Posts:
    28


    If I am in play mode, it runs buttery smooth, only and when I am messing with the Hierarchy, project view, etc it is fine. The lag only happens when I try to move the sceneview camera
     
  19. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,198
    Right, please file a bug report regarding FindMainCamera performance being abysmal in SceneView rendering. We'll need a repro project for this. Also if you post the case number here once you've got it, I can keep track of it :)
     
  20. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,198
    though maybe it could be related to the Gaia Scene view tooling or water shaders or something like that?
    What happens if you untoggle the Aura Preview?
     
  21. POC0bob

    POC0bob

    Joined:
    Feb 22, 2017
    Posts:
    28
    Sadly, this has been happening since before Gaia. I'll check Aura as soon as I can.
     
  22. oxysofts

    oxysofts

    Joined:
    Dec 17, 2015
    Posts:
    124
    Hi, just wanted to say we are having this issue in 2019.3.14f1 and are using Aura 2 as well. However I get this issue even with Aura Preview disabled.
     
  23. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,198
  24. oxysofts

    oxysofts

    Joined:
    Dec 17, 2015
    Posts:
    124
    Unfortunately it doesn't seem to be the issue on our side

    upload_2020-5-26_14-57-43.png

    It seems like any drop in performance will trigger this bug. The scene view isn't running any slower than previously in 2019.2, and there is barely a noticeable drop in performances when I move the scene camera. It's almost as if user inputs are being buffered faster than the FPS should allow, thus it keeps firing for a while after you let go. It does seem to get worse the lower the FPS, but I think this is a specific bug hidden somewhere and will always occur the moment performances drop for any reason.

    Interestingly, another of our programmers has reported a very similar issue, only this time in the game itself! In one of our larger scenes, he says that keyboard and mouse inputs would keep firing long after being released and the player would keep moving. Surprisingly, using the gamepad instead of keyboard and mouse did not result in this issue. I have not tested this myself so I can only relay his experience, but I believe I noticed it as well in one of the lighter playground scenes I was working in where the player kept walking for half a second after letting go.

    Perhaps this could be a bug in 2019.3 with the new Input System package version 1.0.0 which we are using? @POC0bob can you confirm whether you are using the new Input System as well? I'll try to see if I can reproduce the issue soon this week in a fresh project with a script designed specifically to lag up the editor.
     
  25. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,198
    Sounds a bit like what some reported in this thread. If you can confirm that this is not due to your input handling/camera controlls or Gaia/Aura/similar plugins, it would be good to not just report this in the forums (which with issues this neboulous tends to lead to a bunch of false presumed dublication and is usually also to confuse to to anything with on our side) but to file a bug report on it, even if this feels like it could be a dublicate. Our QA will know to flag it as such if it does indeed apear to be one. It's usually better to be on the safe side than wait for a fix for an issue we somehow don't yet know about.
     
    oxysofts likes this.